Exforsys

Online Training

Is this Right

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 ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-22-2007, 07:13 AM
Senior Member
 
Join Date: Apr 2006
Posts: 125
ashlee is on a distinguished road
Is this Right

My friend says the below C++ code
class sample
{
protected:
sample( );
};

Is the above class constructed in a such way that it’s gets allocated on the stack. Is this true? Kindly update on this idea.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-28-2007, 04:30 PM
Senior Member
 
Join Date: Apr 2006
Posts: 144
caradoc is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:42 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.