c++ - trying to use my custom class constructor without new -
c++ - trying to use my custom class constructor without new -
coming java not have deal de-allocation when creating new custom or other library's objects.
today trying create instance of entity object like:
entity cube = new entity("entityname")
because how entity's constructor formatted next error:
cannot convert |entity *| |entity|
i noticed there no errors if remove new
keyword, , wondering 2 things.
what error while using new
mean ? (i'm pretty confident how pointers work not started java.)
is ok me create objects without new
keyword or object created? (because there no errors.)
new entity("entityname")
means "create instance of entity
in free store , homecoming pointer instance". since pointer entity
not same entity
, cannot initialise entity
value unless have yet constructor.
the way want is
entity cube("entityname");
and need book on c++.
c++
Comments
Post a Comment