65,211
社区成员
发帖
与我相关
我的任务
分享#include "stdafx.h"
#include <iostream>
class Test
{
#ifdef _not_
private:
virtual Test(const int&){}
Test()
{
std::cout<<"constructor is runing...."<<std::endl;
}
virtual ~Test()
{
std::cout<<"destrutor is runing...."<<std::endl;
}
#endif
};
int main(int argc, char* argv[])
{
Test c;
c;
printf("Hello World!\n");
return 0;
}#include "stdafx.h"
#include <iostream>
class Test
{
Test()
{
std::cout<<"constructor is runing...."<<std::endl;
}
~Test()
{
std::cout<<"destrutor is runing...."<<std::endl;
}
public:
static void Text(){
Test();
}
};
int main(int argc, char* argv[])
{
Test::Text();
printf("Hello World!\n");
return 0;
}
#include "stdafx.h"
#include <iostream>
class Test
{
Test()
{
std::cout<<"constructor is runing...."<<std::endl;
}
~Test()
{
std::cout<<"destrutor is runing...."<<std::endl;
}
public:
static void Text(){
Text();
}
};
int main(int argc, char* argv[])
{
Test::Text();
printf("Hello World!\n");
return 0;
}
这样也行。不过没啥意思吧