Thread: templates and inheritance

  1. #1
    GA ichijoji's Avatar
    Join Date
    Nov 2002
    Posts
    179

    templates and inheritance

    I developed a template stack class a while ago, and I want to use it in a game to control various objects. The game objects will be inherited from the stack class, but I'm not sure how to do this. Is it just
    Code:
    class board_t : public stack_t<block_t> {
    };
    ?
    Illusion and reality become impartiality and confidence.

  2. #2
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    That looks duoc to me.

  3. #3
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    Technically that should be valid (depending on how stack_t and block_t are defined), but design-wise it would probably be better to just have a member variable for your stack.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inheritance and templates
    By misplaced in forum C++ Programming
    Replies: 4
    Last Post: 10-02-2004, 03:25 AM
  2. Dilemma with templates and inheritance..!
    By Halloko in forum C++ Programming
    Replies: 3
    Last Post: 07-21-2004, 01:01 PM
  3. templates and inheritance problem
    By kuhnmi in forum C++ Programming
    Replies: 4
    Last Post: 06-14-2004, 02:46 AM
  4. Problem with overloaded operators, templates and inheritance
    By bleakcabal in forum C++ Programming
    Replies: 1
    Last Post: 03-19-2004, 05:07 AM
  5. Mixing templates and inheritance, and the damage caused ;)
    By SilentStrike in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 11:47 PM