I ran into a code yesterday, like this:
#include <stdio.h>
using namespace std;
class test {
public:
test()
{
printf("This is test's construct\n");
}
~test()
{
printf("This is test's destroy\n");
}
};
int main()
{
test t(); // no output
return 0;
}
when I run this program, no output
But if I change
test t();
into
test t;
the output is as follows
This is test's construct
This is test's destroy
So I want to ask why the first example has no output?