Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include using namespace std; class PersonInfo { public: void SetNumKids(int personsKids); void IncNumKids(); int GetNumKids() const; private: int numKids; }; void PersonInfo::SetNumKids(int personsKids) { numKids
#include
class PersonInfo { public: void SetNumKids(int personsKids); void IncNumKids(); int GetNumKids() const; private: int numKids; };
void PersonInfo::SetNumKids(int personsKids) { numKids = personsKids; return; }
void PersonInfo::IncNumKids() { numKids = numKids + 1; return; }
int PersonInfo::GetNumKids() const { return numKids; }
int main() { PersonInfo person1;
person1.SetNumKids(3);
/* Your solution goes here */
return 0; }
Challenge 15.2.1: Basic class use. Activity Print person1's kids, apply the IncNumKids0 function, and print again, outputting text as below. End eac Sample output for below program: Kids 3 New baby kids now 4 18 void Person Info: IncNumKidsCD 1 19 numKids numKids 1 20 return 21 23 int Person Info::GetNumKidsO const return numKids 25 26 27 int main 28 PersonInfo personl; 29 30 personl SetNumKidsC3); 31 32 Your solution goes here 33 return 0 35
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started