I'm trying to learn C++ OOP and thought would try a simple example using Qt Creator. I clicked New Project > Projects > application > Qt Console Application
I then added a new class, test.cpp. Both test.cpp and main.cpp are in the Sources folder and test.h is in the Headers foler.
Here is test.h
#ifndef TEST_H
#define TEST_H
class test
{
public:
test();
};
#endif // TEST_H
test.cpp
#include "test.h"
#include "iostream"
using namespace std;
test::test()
{
cout<<"Inside test's constructor "<<endl;
}
main.cpp
#include "iostream"
#include "test.h"
using namespace std;
int main()
{
test ts;
return 0;
}
When I click the run button, it's built and run. The console window displays but "Inside test's constructor" never gets to be printed to the screen. What am I doing wrong?