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 1 of 3.

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

Shashi said:   1 decade ago
There is no error in this program. It does not matter whether the body is defined or not. It will compile successfully.

Anirban Sanyal said:   1 decade ago
Ya it will compile because class can be protected inherited from other class.

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

Nara said:   1 decade ago
It will compile successfully. A class can have no members.

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

Pankaj sharma said:   1 decade ago
It will compile successfully but will not execute as main is the very first function to be called and it is called every time by say a master program running somewhere behind and from there the further references are given by us to do whatever required acc to need.

So it will only compile not execute.

Suman said:   1 decade ago
The code will compile properly. Since the existence of class is only by object of that particular class and there are know syntax error in the code.

Prince jha said:   1 decade ago
But scope resolution operator is not used properly. Can any body tell elaborately?

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


Post your comments here:

Your comments will be displayed after verification.