?
=?gb2312?B?w7fR08zO?=
Hi,sir,please look at this code.
///////////////////////////////////////////////////
#include <iostream>
using namespace std;
class A{
private:
class B;//
public:
int out(int x){
return outB(x)->a;
}
B * outB(int x);
private:
B* root;
class B{
int a;
B(int init_a) :a(init_a){}
friend class A;
};
};
A::B* A:
utB(int x){
root = new B(x);
return root;
}
int main(int argc, char *argv[])
{
A a1;
cout<<a1.out(8)<<endl;
}
//////////////////////////////////////////////////////////////////////////////////////
I want to use
"typedef A::B C;"
to make the code more readable.
But I don't know where should I put typedef?
Thank you very much!
///////////////////////////////////////////////////
#include <iostream>
using namespace std;
class A{
private:
class B;//
public:
int out(int x){
return outB(x)->a;
}
B * outB(int x);
private:
B* root;
class B{
int a;
B(int init_a) :a(init_a){}
friend class A;
};
};
A::B* A:
root = new B(x);
return root;
}
int main(int argc, char *argv[])
{
A a1;
cout<<a1.out(8)<<endl;
}
//////////////////////////////////////////////////////////////////////////////////////
I want to use
"typedef A::B C;"
to make the code more readable.
But I don't know where should I put typedef?
Thank you very much!