I've made a Class with name Matrix. This class has two constructor, one default constructor and one copy constructor. In addition there is a public method called Determinant .In main I write :
Matrix a();
a.Determinant()
or
Matrix a();
a->Determinant()
But none of them is valid. I print the type of the a but I can't understand what type is this ?
This is C++'s most vexing parse. The line:
Matrix a();
Is interpreted as a declaration of a function that accepts no arguments and returns a Matrix
. The proper way to create a default constructed object is simply
Matrix a;