Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example 3 : Inheritance = Consider the following C + + class definition: public class AClass { private: int x , y ; public: Aclass

Example 3: Inheritance
= Consider the following C++ class definition:
public class AClass{
private:
int x,y;
public:
Aclass (int a, int b) : x(a), y(b){}
int addEm() i
return x+y;
}
...
}
You want to derive a subclass from AClass called BClass. BClass will have a third int instance data, z. Which of the following would define BClass's constructor?
a. BClass (int a, int b, int c): AClass (a, b), z (c) f
b. BClass (int a, int b, int c)(x=a;y=b;z=c; }
c. BClass (int a, int b, int cz=C;
AClass (a, b) ; }
d. BClass(int a, int b, int c) : z(c)1
AClass (a, b) ; }
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions