Thread: a class for representing usage

  1. #1
    Unregistered
    Guest

    a class for representing usage

    class g_cPolygon: public g_cDrawable, public g_cUser<g_cVertexArray>
    {
    protected:
    g_cArray<g_cIndex> m_iIndexes;
    public:
    g_cPolygon();
    g_cPolygon(...);
    virtual ~g_cPolygon();

    virtual void m_vfDraw();
    };

    Today I was going to make a polygon class that supported vertex arrays wanted to place a static vertex array in the polygon class. Although, I also wanted to make the program as extencible as I could and therefor wanted all classes that used vertex arrays to be able to share the same one and having the vertex array in the class at the same time. First of all I though about using the "static" keyword, although after a few seconds of consideration I discovered that it wouldn't work. Then I thought that I could make sort of a user class from which the polygon class could inherit, in which I would have something static.
    I just wonder if any of you have had any experence with this, if there are better solutions and offcourse: why aren't there a feature like this within the language?

  2. #2
    Unregistered
    Guest
    I belive my last post above is a bit fuzzy and I therefore feel a need to explain my problem more clearly: I want to make a user class so that I can inherit a static thing into my class like this:

    template <class t_cUsed>
    class g_cUser
    {
    protected:
    t_cUsed m_uUsed;
    public:
    //.... some functions.
    };

    class Polygon: public g_cUser<g_cVertexArray>
    {
    public:
    // Some functions
    };

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. Mmk, I give up, lets try your way. (Resource Management)
    By Shamino in forum Game Programming
    Replies: 31
    Last Post: 01-18-2006, 09:54 AM
  4. class errors
    By romeoz in forum C++ Programming
    Replies: 3
    Last Post: 09-16-2003, 07:57 PM