What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class Second;
class Base {
int age;
public:
Base () { age=5; };
friend void set(Base &ob, Second &so);
void Print() { cout << age;}
};
class Second {
string name;
public:
friend void set(Base &ob, Second &so);
void Print() { cout << name;}
};
void set(Base &ob, Second &so) {
ob.age = 0; so.name = "Bill";
}
int main () {
Base a;
Second b;
set(a,b);
a.Print();
b.Print();
return 0;
}
Ozell
1 day agoHollis
7 days agoCecily
12 days agoWalton
17 days agoGwen
22 days agoCarmelina
27 days agoQueen
1 month agoCarisa
1 month agoLeatha
1 month agoMarti
2 months agoDonette
2 months agoLeonor
2 months agoErnie
2 months agoHubert
2 months agoGregg
3 months agoBulah
3 months agoYolande
3 months agoCeola
3 months agoJame
2 months ago