c++ - Main differences between objects and object pointers? -
what's difference between doing,
eventlist temp; eventlist* temp = new eventlist();
where temp access it's vars doing using .
, other ->
besides difference, else? pointer allocates on heap while eventlist
on stack. scope thing?
eventlist temp
allocated , deallocated automatically within scope in called. is, when run following code:
{ eventlist temp; }
the default constructor eventlist
called @ point of declaration, , destructor called @ end of block.
eventlist *temp = new eventlist();
allocated on heap. can read more here.
Comments
Post a Comment