wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

In C++, by default, the members of a class are.

A
Public
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
Private
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
Both public and private
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
None of these
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B Private

In C++, by default, the members of a class are private.

A class in C++ is a user defined type or data structure declared with keyword class that has data and functions as its whose access is governed by the three access specifiers private, protected or public.

The default access specifier is an important differentiate between classes and structs. It is public by default for structs and private by default for classes.



903648_916587_ans_f4127199354843f4ab2b27798dc6b037.PNG

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Sarrus Rule
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon