Here is simple program. If I comment constructor, I get an error Just wanted to check what is the reason for this?
t.cc: In function 'int main(int, char**)':
t.cc:26: error: uninitialized const 'const_test'
#include <iostream>
using namespace std;
class TestPrint
{
public:
// TestPrint() {}
void Print()
{
std::cout << "TestPrint" << std::endl;
}
void Print() const
{
std::cout << "const TestPrint" << std::endl;
}
};
int main(int argc, char* argv[])
{
TestPrint normal_test;
normal_test.Print();
const TestPrint const_test;
const_test.Print();
}