#include
#include
class B
{
private:
char m_strName[80];
double b;
public:
B(char *a,double n)
{
strcpy(m_strName,a);
b=n;
cout<<"construct\n";
}
B(double n)
{
strcpy(m_strName,"test");
b=n;
cout<<"test\n";
} dddddddd
B()
{
cout<<"Default\n";
}
~B()
{
cout<<"Destructor"< }
void GetVar(char *s,double n)
{
strcpy(s,m_strName);
n=b;
}
};
int main(int argc,char *argv[])
{
B*p;
double n;
char s[80];
p= new B[2];
p[0]=B("aa",4.8);
p[1]=B("bb",3.6);
for(int i=0;i<2;i++)
{
p[i].GetVar(s,n);
cout< }
delete []p;
return 0;
}
阅读(680) | 评论(0) | 转发(0) |