+ 1

1What happens when we try to compile the class definition in following code snippet?

class Birds {}; class Peacock : protected Birds {}; A. It will not compile because class body of Birds is not defined. B. It will not compile because class body of Peacock is not defined. C. It will not compile because a class cannot be protectedly inherited from other class. D. It will compile succesfully.

29th Aug 2017, 4:01 PM
Nidhi Undirwade
Nidhi Undirwade - avatar
4 odpowiedzi
+ 2
I think D: it will compile successfully.
12th Sep 2017, 12:22 PM
HASHIR IMAM
HASHIR IMAM - avatar
0
The answer is C
26th Oct 2017, 5:49 PM
Lakshmi
0
If the answer is D Then explain it how it compile successfully
26th Oct 2017, 5:50 PM
Lakshmi
0
@Laksmi I wrote this program and compiled, it works. By the way we can use the inheritance in protected mode . So its D. If I am wrong somewhere please explain it to me.
27th Oct 2017, 1:49 AM
HASHIR IMAM
HASHIR IMAM - avatar