+ 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); }
1 Answer
+ 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);
}