Interesting Question: how can you design a class on stack frame?

This is a discussion on Interesting Question: how can you design a class on stack frame? within the C++ Programming forums, part of the General Programming Boards category; How to design a class which can only be allocated from stack frame? Any ideas?...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    284

    Interesting Question: how can you design a class on stack frame?

    How to design a class which can only be allocated from stack frame? Any ideas?

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    Do you mean allocated on the stack ?

    Code:
    class foo
    {
    protected:
        foo( );
    };

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    Thanks, but why this class is allocated on the stack?

    Quote Originally Posted by Desolation View Post
    Do you mean allocated on the stack ?

    Code:
    class foo
    {
    protected:
        foo( );
    };

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    284
    And how do you make an instance of class foo?

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    903
    Meh, nevermind. That's a class that just can't be instantiated. I thought for a second that you would just make it friend to another class but that would give it the right to instantiate it on the heap. Sorry.

  6. #6
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    902
    overload new to not allow dynamic allocation? Perhaps I'm getting my terms mixed up.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 01-13-2008, 04:57 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Replies: 3
    Last Post: 10-31-2005, 11:05 AM
  4. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21