#include<iostream>
using namespace std;
class newcla
{
public:
newcla(){cout<<"begin new class newcla!"<<endl;};
~newcla(){cout<<"Be over!"<<endl;}
};
int main()
{
cout<<".............."<<endl;
{
newcla var;
}
cout<<".............."<<endl;
return 0;
}
举个简单的例子
using namespace std;
class newcla
{
public:
newcla(){cout<<"begin new class newcla!"<<endl;};
~newcla(){cout<<"Be over!"<<endl;}
};
int main()
{
cout<<".............."<<endl;
{
newcla var;
}
cout<<".............."<<endl;
return 0;
}
举个简单的例子