What is the output of the program?

What is the output of the program?
#include using namespace std;
class Base { static int age; public: Base () {}; ~Base () {}; void setAge(int a=10) {age = a;}
void Print() { cout << age;} }; int Base::age=0; int main () { Base a,*b; b = new Base(); a.setAge(); b?>setAge(20); a.Print(); b?>Print(); return 0;
}
A. It prints: 2020
B. It prints: 1020
C. It prints: 20
D. It prints: 10

Download Printable PDF. VALID exam to help you PASS.

Posted in: CPA

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.