

It can have access to private, public and protected data members of its class, but cannot access private data members of another class.Ĩ Example: Class test cout> a > b private : t.set_data(a,b) int a cout b) return a else return b } void main() test t int a,b ĩ Definition of function outside a class. It can be defined inside or outside the class. Protected specifier is used for declaring the class members which can be accessed by its own class and its derived class.ħ Member Function Member function’s name is visible outside the class. There may be any number of private, public or protected section in a class declaration.

If no member access specifier is specified then by default the members are private for the class. It is not mandatory that private section has to declared first in the class and then the public section. Private section of a class can have both data members and member functions, usually data members are made private for data security. Passing an argument to the member functionĦ Characteristics of access specifiers (private,public and protected) Include string class definition Member function parameter Use the function parameter as a variableĥ Member Functions with Parameters (cont.) Presentation on theme: "DATA HIDING AND MEMBER FUNCTIONS"- Presentation transcript:ĭata Hiding and Member Functions Object Creation and Destruction Polymorphism data abstraction Iterators and Containersģ Today’s class is about Data Hiding and Member functions
