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

A member function can always access the data

A
in the object of which it is a member
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
in the class of which it is member
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
in the public part of its class
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 in the class of which it is member

A member function can access its class member variables, irrespective of the access specifier in which the member variable is declared. So, a member function can always access the data in the class of which it is a member.

Functionswithin classes can access and modify data members without declaring them, because the data members are already declared in the class.

A member function of a class is a function that has its definition or its prototype within the class definition like any other variable. It operates on any object of the class of which it is a member, and has access to all the members of a class for that object.


flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Types of Property
CIVICS
Watch in App
Join BYJU'S Learning Program
CrossIcon