Question: Consider the following C + + classes: class a { public: void p 1 ( ) ; virtual void p 2 ( ) ; protected:

Consider the following C++ classes:
class a {
public:
void p1();
virtual void p2();
protected:
void r1();
void r2();
private:
void v1();
};
class b : public a {
public:
void p1();
void p2();
};
int main()
{
b *x = new b();
x->p1();
((a*) x)->p2();
return 1;
}
Does class b inherit the function v1()?
[ Select ]
Does class b inherit the functions r1() and r2()?
[ Select ]
In main(), which version of p1() is called?
[ Select ]
In main(), which version of p2() is called?
[ Select ]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!