[go: up one dir, main page]

0% found this document useful (0 votes)
8 views3 pages

Lec 3 Member Functions

Uploaded by

mihirkanojia95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Lec 3 Member Functions

Uploaded by

mihirkanojia95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Member Functions

- A function is a Member Function if it can be declared as a member of the class


(Function declaration or de nition within the class).
- It operates on any object of the class of which it is a member, and has access to all the
members of a class for that object (public as well as private).

How to define member functions?


1. Within the class
- A member function will be called using a dot operator (.) on an object.
fi
2. Outside the class (using Scope Resolution Operator(::))
- Here, only important point is that you would have to use class name just before ::
operator.
- Scope of the function is restricted to the class name given.
- Calling the member function is same as before.
Features of Member Functions
- Several classes can use same function names, the con ict will be resolved by the
membership label.
- Member functions can access all data of its class(whether private or public).
- A member function can call another member function directly without using (.) operator.

fl

You might also like