Question: 1 : #include 2 : using namespace std; 3 : 4 : / / 5 : 6 : class A 7 : { 8 :

1: #include 2:
using namespace std;3:
4: //
5:
6: class A
7: {
8: private:
9: int x;
10: protected:
11: int getX();
12: public:
13: void setX();
14: };
15:
16: int A::getX()
17: {
18: return x;
19: }
20:
21: void A::setX()
22: {
23: x=10;
24: }
25:
26://
27: class B
28: {
29: private:
30: int y;
31: protected:
32: A objA;
33: int getY();
34: public:
35: void setY();
37: };
38:
39: void B::setY()
40: {
41: y=24;
42: int a = objA.getX(); 43: }
44:
45://
46:
47: class C: publicA
48: {
49: protected:
50: int z;
51: public:
52: int getZ();
53: void setZ();
54: };
55:
56: int C::getZ()
57: {
58: return z;
59: }
60:
61: void C::setZ()
62: {
63: z=65;
64: }
Class C has public inheritance with the class A. Identify and list class Cs
private, protected and public member variables resulting from the
inheritance.
a)This question is based on question 2(d) in the written Assignment 4. Question 2 included a code fragment that you had to answer questions on. In this code fragment class C has public inheritance with the class A. Identify and list class Cs public data members resulting from the inheritance.
Class C has no public data members resulting from the inheritance.
Select one:
True
False
b)This question is based on question 2(d) in the written Assignment 4. Question 2 included a code fragment that you had to answer questions on. In this code fragment class C has public inheritance with the class A. Identify and list class Cs protected data members resulting from the inheritance.
Class C has no protected data members resulting from the inheritance.
Select one:
True
False
c)This question is based on question 2(d) in the written Assignment 4. Question 2 included a code fragment that you had to answer questions on. In this code fragment class C has public inheritance with the class A. Identify and list class Cs private data members resulting from the inheritance.
Class C has no private data members or member functions resulting from the inheritance because private data members are never inherited.
Select one:
True
False

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!