C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 54)
54.
Which of the following access specifier is used as a default in a class definition?
Discussion:
11 comments Page 1 of 2.
Ravi kant chauhan said:
1 decade ago
In C++, all the members of a class is by default private member.
Biren Mishra said:
1 decade ago
Dear @Ravi, In the question it is given as class Definition not class member. So default access specifier for a class definition is either public or Internal. So the answer should be public(option B).
Rajabhupal said:
1 decade ago
In C++ we declare any function before these functions use access specifiers those are public, private in this public is explicitly declare by the programmer but private declared as default.
Puja shahi said:
1 decade ago
Yes it is private by default both in C++ and Java.
Bhushan said:
1 decade ago
One of the big five feature of OOPS languages is inheritance. Then if we declare the class as private then there is no use of inheritance.
Sudhanshu Shukla said:
10 years ago
Dear @Puja Shahi.
Class can never declare private in Java.
Class can never declare private in Java.
Sheikh Asrar Danish said:
9 years ago
Here the question is default class definition, and we all knows that public is by default assign to class at the time definition. So ANSWER must be option B.
Sushumna said:
8 years ago
I think it is option B. Because public is always a default one.
Srinidhi said:
7 years ago
Yes, it's public. I also agree.
Haripriya said:
6 years ago
Yes, I think the option B is correct.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers