# include <cstring>
# include <iostream>
# include <cstdio>
using namespace std;
class a{
public:
a(){}
a(int c, int b): c(c), b(b){
}
private:
int c;
int b;
}
ostream &operator<<(ostream & os , const a &c){
os << a << ' ' << b;
return os;
}
int main(){
a d(10, 20);
cout << d;
return 0;
}
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
# include <cstring>
# include <iostream>
# include <cstdio>
using namespace std;
class a{
public:
a(){}
a(int c, int b): c(c), b(b){
}
friend ostram& operator<<(ostream &,const a&);
private:
int c;
int b;
};
ostream &operator<<(ostream & os , const a &c){
os << c.c << ' ' << c.b;
return os;
}
int main(){
a d(10, 20);
cout << d;
return 0;
}
uj5u.com熱心網友回復:
隨便起名的話類最好還是大寫比較好。。轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/234536.html
標籤:C++ 語言
上一篇:陣列中字串長度例外
