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;
}
Malissa
2 months agoPearlie
2 months agoErnest
2 months agoAdolph
2 months agoErick
2 months agoNobuko
2 months agoKrissy
3 months agoOzell
3 months agoHollis
3 months agoCecily
4 months agoWalton
4 months agoGwen
4 months agoCarmelina
4 months agoQueen
4 months agoCarisa
4 months agoLeatha
5 months agoMarti
5 months agoDonette
5 months agoLeonor
5 months agoErnie
5 months agoHubert
6 months agoGregg
6 months agoBulah
6 months agoYolande
6 months agoCeola
7 months agoLashon
27 days agoMarion
1 month agoLavina
1 month agoAshlee
1 month agoJame
6 months ago