Code:I have class C{ ... C& operator<<(C& os, const char* str) { ... } void display() { Is there anyway I can call operator<< in here? }
This is a discussion on Is there a way to call an operator function from another member function? within the C++ Programming forums, part of the General Programming Boards category; Code: I have class C{ ... C& operator<<(C& os, const char* str) { ... } void display() { Is there ...
Code:I have class C{ ... C& operator<<(C& os, const char* str) { ... } void display() { Is there anyway I can call operator<< in here? }
If you don't actually need to directly access any private member variables, then make that member function into a non-member non-friend function.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
thank you