Why is there no call to the constructor?

Viewed 1295

This code doesn't behave how I expect it to.

#include<iostream>
using namespace std;

class Class
{
    Class()
    {
        cout<<"default constructor called";
    }

    ~Class()
    {
        cout<<"destrutor called";
    }
};

int main()
{    
    Class object();
}

I expected the output 'default constructor called', but I did not see anything as the output. What is the problem?

3 Answers
Related