This might be a newbie question, but I am asking myself it anyway.
If I have a Object
class defined:
Object *p = new Object();
Does this code create a pointer p
, and at location p
, place a Object
object, correct?
This might be a newbie question, but I am asking myself it anyway.
If I have a Object
class defined:
Object *p = new Object();
Does this code create a pointer p
, and at location p
, place a Object
object, correct?
This means:
p
p
.Edit: In response to comment:
This is not the only way to construct a class. The other one is to allocate a class statically, eg.
Parent p;
In such case you don't store a pointer to the Parent class in variable p, but the whole class itself. In such case: