C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - General Questions (Q.No. 1)
1.
What happens when we try to compile the class definition in following code snippet?
class Birds {};
class Peacock : protected Birds {};
It will not compile because class body of Birds is not defined.
It will not compile because class body of Peacock is not defined.
It will not compile because a class cannot be protectedly inherited from other class.
It will compile succesfully.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
30 comments Page 3 of 3.

Sree said:   1 decade ago
Program compile successfully but no o/p will be providing!

Xxx said:   9 years ago
Agree with you @Akshay. So confused to choose the answer.

Irshad said:   1 decade ago
Will it run successfully without declared main method ?

Bhn said:   8 years ago
Class can be protected & inherited from other class.
(1)

Ramkishore Gautam said:   8 years ago
It will not compile successfully without main ().
(1)

Srijeth said:   1 decade ago
What does class peacock:protected birds{}; mean?

Naveen said:   9 years ago
There is no output but it compiled sucessfully.

Love juneja said:   1 decade ago
Scope resolution operator is not used properly.

Arjun said:   1 decade ago
It is under the other defined class.

Raees said:   8 years ago
Yeah, it will compile.
(1)


Post your comments here:

Your comments will be displayed after verification.