Saved Bookmarks
| 1. |
Can we use the same function name for a member function of a class and an outside i.e., a non-member function in the same program file? If yes, how are they distinguished? If no, give reasons. Support your answer with examples. |
|
Answer» Yes. Object of the class is used to distinguish between the member function of a class and a non-member function with same name. Ex class X { public: void f() {.....} }; void f() {.....} void main() { X x; x.f(); // member function of the class x f(); // non-member function } |
|