This is a discussion on Is this Right within the C and C++ forums, part of the Programming Talk category; My friend says the below C++ code class sample { protected: sample( ); }; Is the above class constructed in a such way ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Yes the class you have given in the thread is constructed in such a way that it’s gets allocated on the stack. Additional information about the class you have given is it cannot be instantiated. But you can make this class as a friend of another class and then try for instantiation but in that case it would loose the stack structure and would get allocated as a heap. So depending on your requirements go on with the process.
|