What does the following variable definition mean?
class MyClass* myClass;
I tried running the code class MyClass* myClass = new MyClass();
and found that it simply creates a pointer to a new instance of MyClass
.
What is the purpose of using the class
prefix here? Does it make any difference?
An elaborated type specifier is a type name preceded by either the class, struct, enum, or union keyword.
class identifier
struct identifier
enum identifier
union identifier
An elaborated type specifier is used either for emphasis, or to reveal a type name that is hidden by the declaration of a variable with the same name in the same scope.