Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
What is protected access specifier in cpp?
4 Respostas
+ 5
Protected members are accessible within the same class and classes derived from it but not other classes.
+ 2
There are 3Ā access specifiersĀ for a class/struct/Union in C++. These access specifiers define how the members of the class can be accessed. Of course, any member of a class is accessible within that class(Inside any member function of that same class). Moving ahead to type of access specifiers, they are:
PublicĀ - The members declared as Public are accessible from outside the Class through an object of the class.
ProtectedĀ - The members declared as Protected are accessible from outside the classĀ BUTĀ only in a class derived from it.
PrivateĀ - These members are only accessible from within the class. No outside Access is allowed. ok
0
Protected is similar to private as anything outside the class cannot access it, but private variables & methods cannot be inherited but protected can be inherited by the subclass.
0
Hello