你说得也对
我只是一边学,一边想。。。想到什么不明边拿上来问
//////////////print.h
#include <iostream> #include <vector> #include <string>
using namespace std;
class Text{ int NO; int age; public: void initText(int NOs, int ages){NO=NOs;age=ages;} int get_NO(){return NO;} int get_age(){return age;} };
///////////////////////////////////transform.cpp
#include <iostream> #include <vector> #include <set> #include <algorithm> #include "print.h"
using namespace std;
main(){
Text tex ; tex.initText(1,24); vector<Text> temp; temp.push_back(tex); tex.initText(3,23); temp.push_back(tex); tex.initText(3,23); temp.push_back(tex); cout<<temp[0].get_NO()<<endl; cout<<temp.size()<<endl;
}