Friday, November 19, 2010

Const Objects

The following program compiles:

class MyClass
{ };

const MyClass myObject = MyClass();

int main()
{
  return 0;
}

If you remove the "= MyClass()", the program will not compile.

No comments:

Post a Comment