This's my first CSDN Blog

mac2025-09-03  11

//You can do it. This is my first Blog. It’s a time Mark. //2019.11.01 #include “stdafx.h” #include “iostream” using namespace std; class Sample { int a; char name[20]; public: Sample(){} Sample(int i,char *nam) { a=i; memcpy(name, nam,strlen(nam)+1); } friend ostream& operator <<(ostream& ost, Sample&sam) { cout<<“int a=”<<sam.a<<endl; cout<<“name is”<<sam.name<<endl; return ost; } };

最新回复(0)