Private protected private private the members are

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: bject 123 245 245 Object Object Access level Access The classes in C++ have 3 important access levels. The Private, Public and Protected. Private, Protected Private: Private: The members are accessible only by the member functions or friend functions. Protected: Protected: These members are accessible by the member functions of the class and the classes which are derived from this class. Public: Public: Accessible by any external member. Accessible General Syntax of OOP in C++ General Syntax of OOP in C++ class classname { Access specificer: Member variables Main body of OOP Member Functions }; class student class student { data types here… int reg_id; function(2) here… void show() { . . . } }; void main () { student object_of_studentclass; . . . . } 1 2 // Define class GradeBook with a member function displayMessage; 3 // Create a GradeBook object and call its displayMessage function. 7 8 9 10 11 12 13 Beginning of class definition // GradeBook class definition for class GradeBook class GradeBook Beginning of class body { Access specifier public; makes public: members available to the...
View Full Document

Ask a homework question - tutors are online