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 {};
Discussion:
30 comments Page 2 of 3.
Bhuvnesh kumar said:
1 decade ago
It is will compile properly because peacock is class which protected inherits the class bird.
Debasmita Manna said:
1 decade ago
I do think that option d is correct because compiler is already mention bird as a class.
Nirbhay singh said:
10 years ago
This program is correct but no output. Because no constructor and destructor are use.
Prince jha said:
1 decade ago
But scope resolution operator is not used properly. Can any body tell elaborately?
Kirti said:
1 decade ago
In the above program peacock is a class which protected inherits the class bird.
Sumasree said:
1 decade ago
Without main method it's shows like this message -undefined reference to 'main'.
Anirban Sanyal said:
1 decade ago
Ya it will compile because class can be protected inherited from other class.
Sann said:
10 years ago
What situation we should inherit protected or private if class is public?
PRABAVATHY said:
10 years ago
Ya it will inherited when we inherit using public and protected.
Nara said:
1 decade ago
It will compile successfully. A class can have no members.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers