the compile results of those 2 prgs? a) class Top { public: int a; Top(int x) {
ID: 3533515 • Letter: T
Question
the compile results of those 2 prgs?
a)
class Top {
public:
int a;
Top(int x) { a = x;}
};
class Bottom : public Top {
public:
int b;
Bottom() : Top(5) { b = 0; a = 0;}
};
int main() {
Bottom barrel;
cout << barrel.a <<" " << barrel.b;
}
b)
class Top
{ public:
Top() { cout << "Start Top ";}
~Top() { cout << "End Top ";}
};
class Bottom : public Top
{ public:
Bottom() { cout << "Start Bottom ";}
~Bottom() { cout << "End Bottom ";}
};
class Test
{ public:
Bottom deal;
Test() { cout << "Start Test ";}
};
int main(){
Test me;
}
Explanation / Answer
a)
5
0
b)
Star Test
Start Bottom
End Bottom
Start Top
End Top
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.