0

Looking at 3 ways to instantiate an object of a class I created;

  1. MyClass myObject = MyClass();
  2. MyClass myObject();
  3. MyClass myObject;

I defined a default constructor (which sets up a 2D array), and defined some operator overloads so I can use:

cout << myObject[x][y] << endl;

That line of code works when I instantiate myObject with option 1 or 3, but not 2. VS2017 reports, for that line: "expression must be a pointer to a complete object type".

Xenial
  • 465
  • 2
  • 15

0 Answers0