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 3 of 3.
Love juneja said:
1 decade ago
Scope resolution operator is not used properly.
Prince jha said:
1 decade ago
But scope resolution operator is not used properly. Can any body tell elaborately?
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.
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.
So it will only compile not execute.
Irshad said:
1 decade ago
Will it run successfully without declared main method ?
Nara said:
1 decade ago
It will compile successfully. A class can have no members.
Arjun said:
1 decade ago
It is under the other defined class.
Anirban Sanyal said:
1 decade ago
Ya it will compile because class can be protected inherited from other class.
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.
Sree said:
1 decade ago
Program compile successfully but no o/p will be providing!
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers