Access specifier kya hota hai
Answers
Answered by
2
Access specifier :-
It is a keyword used for defining how a function or variable can be accessed in the code or program from a class.
There are mainly three access specifiers :-
public
Functions or varibles declared by public can be access from anywhere. This is usually used when we want the variable or function to be used in various function.
private
Functions or variables defined by the private access-specifier can only be accessed in a class and also any function that can access these variables or functions should be a member function of that class. friend functions can also access these variables or functions.
protected
Functions or variables declared using the protected keyword can be accessed by the subclasses only.
Similar questions