This is a simple C++ constructor concept I'm having trouble with.
Given this code snippet:
#include <iostream>
using namespace std;
class Foo
{
public:
Foo () { cout << "Foo()" << endl; }
~Foo () { cout << "~Foo()" << endl; }
};
int main()
{
Foo f1;
Foo f2();
}
The output was:
Foo()
~Foo()
It seems like Foo f2();
doesn't do anything. What is Foo f2();
And why doesn't it do anything?