Before anyone asks, yes, this is part of a homework, and yes, I did a lot of Googling before asking. I spent the last hour searching intensively on Google with many, many different keywords, but just could not find anything.
So here goes the question :
What does the following variable definition mean:
class MyClass* myClass;
?
I tried that code with something like class MyClass* myClass = new MyClass();
and found that it simply creates a pointer to a new instance of MyClass
.
So, what's the advantage of using the class
prefix? Does it make any difference?
Does someone have a link to some resources about it? I simply could not find anything (it's really, really hard to find things other than "class definition"!).
Thanks a lot!
class MyClass {}; int MyClass; MyClass* myClass = NULL;
(won't compile, but you can addclass
keyword to refer to an otherwise hidden name).