+ 3
Can anyone please explain private, public and protected in classes and objects??
classes and objects
2 Réponses
+ 4
thanks a lot with pleasure@ Jonathan Carver.😊. hope you will help me whenever I need it.
+ 3
Private (or class-private) restricts the access to the class itself. Only methods that are part of the same class can access private members.
Protected (or class-protected) allows the class itself and all its subclasses to access the member.
Public means that any code can access the member by its name.
Reference: wikipedia