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

  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
    937
    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, 05: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, 12:05 PM
  4. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM