+ 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.
4 odpowiedzi
+ 2
I think D: it will compile successfully.
0
The answer is C
0
If the answer is D
Then explain it how it compile successfully
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.