- What Is The Output Of This Code Class Student Public Student Age 0 Student Int Init Age Student Age 1 (62.1 KiB) Viewed 21 times
What is the output of this code? class student { public: student() { age = 0; } student(int init_age) { student(); age =
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
What is the output of this code? class student { public: student() { age = 0; } student(int init_age) { student(); age =
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: