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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -