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?
protected
public
private
friend
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
11 comments Page 1 of 2.

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.

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.

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.

Rahul said:   6 years ago
Private is the right answer. The default access specifier in C++ language is private.

Ravi kant chauhan said:   1 decade ago
In C++, all the members of a class is by default private member.

Sushumna said:   8 years ago
I think it is option B. Because public is always a default one.

Sudhanshu Shukla said:   10 years ago
Dear @Puja Shahi.

Class can never declare private in Java.

Puja shahi said:   1 decade ago
Yes it is private by default both in C++ and Java.

Haripriya said:   6 years ago
Yes, I think the option B is correct.


Post your comments here:

Your comments will be displayed after verification.