What is the output of this code? class student { public: student() { age = 0; } student(int init_age) { student(); age =
Posted: Fri May 20, 2022 1:19 pm
What is the output of this code? class student { public: student() { age = 0; } student(int init_age) { student(); age = init_age;) int get_age() {return age; } private: int age; }; class person public: person (std::string init name, int init_age - e, int init_ssn = 2821) name = init_name; age = init_age; ssn = init_55n; private: std::string name; int age; int son: 3: int main() { student mySt1; student mySt2(4); std::cout << mysti.get_age() << std:cendl; std::cout << myStz.get_age() << std::endl; person obj1; return; 000 The following line causes an error, person obj1: The following line causes an error: student myst2(4): The code prints and 4 and successfully completes The following line causes an error: student mySt 1: