Vidyalelo
C++ Programming · Q73

Inheritance in C++

Programming · C++ Programming · question 73

Q73

What will be the output of the following C++ code? #include #include using namespace std; class A int a, b; float d; public: void change(int i) a = i; void value_of_a() cout<<a; ; class B: private A ; int main(int argc, char const *argv[]) B b; cout<<sizeof(B); return 0;

A.
8
B.
12
Answer
C.
Error
D.
Segmentation fault

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board