| | |
Instantiating class
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 11
Reputation:
Solved Threads: 0
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:
CBox a=CBox(1);
CBox b(2);
Definition of CBox is as followed:
C++ Syntax (Toggle Plain Text)
class CBox { public: int abc; CBox(int var){ abc=var; } };
Are you
Are you instantiating an object within a function? If so, that object is on the 'stack'.
new ing? If so, that object is on the 'heap'.Are you instantiating an object within a function? If so, that object is on the 'stack'.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- Executing a Class using path provided in runtime? (Java)
- Which type of class is not instantiated? (Java)
- Instantiating class objects?? (C++)
Other Threads in the C++ Forum
- Previous Thread: Hiding dos window
- Next Thread: a little help with my code
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






