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;
}
Pearlie
2 days agoErnest
7 days agoAdolph
12 days agoErick
18 days agoNobuko
23 days agoKrissy
28 days agoOzell
2 months agoHollis
2 months agoCecily
2 months agoWalton
2 months agoGwen
2 months agoCarmelina
2 months agoQueen
3 months agoCarisa
3 months agoLeatha
3 months agoMarti
3 months agoDonette
3 months agoLeonor
3 months agoErnie
4 months agoHubert
4 months agoGregg
4 months agoBulah
4 months agoYolande
5 months agoCeola
5 months agoJame
4 months ago