C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.54)

54. 

Which of the following access specifier is used as a default in a class definition?

[A]. protected
[B]. public
[C]. private
[D]. friend

Answer: Option C

Explanation:

No answer description available for this question.

Ravi Kant Chauhan said: (May 14, 2013)  
In C++, all the members of a class is by default private member.

Biren Mishra said: (Jun 18, 2014)  
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: (Oct 6, 2014)  
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: (Jan 13, 2015)  
Yes it is private by default both in C++ and Java.

Bhushan said: (Feb 27, 2015)  
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: (Nov 24, 2015)  
Dear @Puja Shahi.

Class can never declare private in Java.

Sheikh Asrar Danish said: (Nov 4, 2016)  
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: (Jul 16, 2017)  
I think it is option B. Because public is always a default one.

Srinidhi said: (Jan 10, 2019)  
Yes, it's public. I also agree.

Haripriya said: (Apr 15, 2019)  
Yes, I think the option B is correct.

Rahul said: (Nov 4, 2019)  
Private is the right answer. The default access specifier in C++ language is private.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.