Thread: Question!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    Question!

    Okay, so this class defines a Cross Object, a Cross is a Mobile, is an Object..

    Code:
    #ifndef C_CROSS_H
    #define C_CROSS_H
    
    
    #include "Mobiles.h"
    
    class Cross : public Mobiles
    {
    public:
    
    
    	MS3DModel *Model1; // pointer to the model all cross instances use
    };
    
    #endif

    What happens if we want more than one Cross Object on the screen at the same time? I don't want to have to hard code another instance of the cross object, how can I make it so the user can create an instance of this object, (say we have a peasant object that has a build function, that can click build->cross, we place another cross on the screen, at a given location)


    Is this what template classes are used for? I'm sure someone here can enlighten me
    Last edited by Shamino; 12-13-2005 at 07:45 PM.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM