#include <iostream>
#include<string>
#include <vector>
using namespace std;
class CNode{
public:
CNode(int val){
pi_val=new int(val);
}
CNode(CNode &other){
pi_val=other.pi_val;
for(int i=0; i<other.v_kids.size(); i++){
v_kids.push_back(other.v_kids[i]);
}
}
~CNode(){
delete pi_val;
for(int i=0; i<v_kids.size(); i++){
delete v_kids[i];
}
}
void vSetVal(int iVal){
*pi_val=iVal;
}
void vAdd(CNode *pcKid){
v_kids.push_back(pcKid);
}
void vPrint(){
cout<<*pi_val;
for(int i=0; i<v_kids.size(); i++){
v_kids[i]->vPrint();
}
}
private:
int *pi_val;
vector<CNode*> v_kids;
};
class CTree{
public:
CTree(){
pc_root=new CNode(0);
}
CTree(CTree &other){
???
}
~CTree(){
delete pc_root;
}
CNode *pcGetRt(){
return pc_root;
}
void vPrint(){
pc_root->vPrint();
}
private:
CNode *pc_root;
};
int main() {
CTree c_t0;
c_t0.pcGetRt()->vSetVal(1);
c_t0.pcGetRt()->vAdd(new CNode(2));
CNode *pc_buf;
pc_buf = new CNode(3);
pc_buf->vAdd(new CNode(4));
c_t0.pcGetRt()->vAdd(pc_buf);
CTree *pc_copy = new CTree(c_t0);
c_t0.vPrint();
//pc_copy->vPrint();
delete pc_copy;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}