Questions: The following few questions involved the classes diagrammed below: Pa
ID: 3677567 • Letter: Q
Question
Questions:
The following few questions involved the classes diagrammed below:
Parent Class
Subclass
Subclass
Class Parent
virtual void foo();
virtual void bar() = 0;
void func1();
protected:
int ParentProtected;
private:
double ParentPrivate;
};
Class Child
void foo( );
void func2();
virtual void bar();
protected:
int ChildProtected;
};
Class GrandChild
virtual void bar();
virtual void foobar();
private:
int GrandChildPrivate;
};
Based on the classes shown above, the next few questions relate to the following declarations shown below:
Child instanceofChild;
Child * ptrChild = &instanceofChild;
GrandChild instanceofGChild;
GrandChild * ptrGrandChild = &instanceofGChild;
Explanation / Answer
1).h file and .cpp file
2).h file and .cpp file
3).h file and .cpp file
4).h file and .cpp file
5)true
6)false
7)no
8)No
9)No
10)True
11)Yes
12)No
13)No
14)yes
15)yes
16)yes
17)yes
18)no
19)no
20)no
21)yes
22)no
23)n0
24)no
25)no
26)yes
27)yes
28)no
29)no
30)Child's version
31)GrandChild's version
32)Child's version
33)GrandChild's version
34)no one called because dot(.) operator is used insted of ->
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.