Is this two ways of instantiating class both acceptable?(My intention is to create CBox on stack instead of heap)
CBox a=CBox(1); CBox b(2); Definition of CBox is as followed:
class CBox { public: int abc; CBox(int var){ abc=var; } };
Are you new ing? If so, that object is on the 'heap'.
new
Are you instantiating an object within a function? If so, that object is on the 'stack'.