+ 2

Please explain clearly how to find the output of the code below?

A little revision, class A{ public: void f() {cout <<1;} }; class B : public A{ private: void f() {cout <<2;} }; void c(A &a) {a. f();} int main(){ B b; C(b); }

3rd Oct 2017, 10:41 AM
SAKSHI
SAKSHI - avatar
1 Resposta
+ 15
A little revision, class A{ public: void f() {cout <<1;} }; class B : public A{ private: void f() {cout <<2;} }; void c(A &a) {a. f();} int main(){ B b; C(b); }
3rd Oct 2017, 10:54 AM
Babak
Babak - avatar