| I have come accross a piece of C++ code with the construct:
|
| MyClass *c = new class MyClass();
|
| Is there a difference between this and:
|
| MyClass *c = new MyClass();
|
| ?
No.
Actually, this is not about "new" and "new class",
but about "MyClass" or "class MyClass".
In C compilers, identifiers that refer to a struct or union
need to be explicitly prefixed with the corresponding keyword:
struct Test { int x,y; };
int f( Test a ); // Error in C, ok in C++
int f( struct Test a ); // ok in C and C++
For the sake of consistency and backwards-compatibility,
C++ allows both ways for referring to a struct, union, or class:
you can also write "class MyClass" to refer to "MyClass".
hth, Ivan