C ++ operator overload

xiaoxiao2021-03-06  38

#include using namespace std;

Class T {public: t () {i = 40;} Friend Ostream & Operator << (Ostream & OS, Const T & T) {OS << Ti << Endl; Return OS;} PUBLIC: INT i;}; Note Function Definition Put it in the class, put it outside to compile

Void main () {t t; cout << t;} or #include So function can be defined outside the class, can

转载请注明原文地址:https://www.9cbs.com/read-71152.html

New Post(0)