What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code?
#include #include
using namespace std;
struct Person { string name; int age;
};
class First
{
Person *person; public:
First() {person = new Person; person?>name = “John”;
person?>age = 30;
}
void Print(){
cout<name << " "<< person?>age;
}
};
int main()
{ First t;
t.Print(); }
A. It prints: 30
B. It prints: John
C. It prints: John 30
D. It prints: John 30John 30

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.