Page 1 of 1

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
by answerhappygod
What Is The Output Of This Code Class Student Public Student Age 0 Student Int Init Age Student Age 1
What Is The Output Of This Code Class Student Public Student Age 0 Student Int Init Age Student Age 1 (62.1 KiB) Viewed 22 times
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: