Thread: class implementing class in same namespace

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    class implementing class in same namespace

    Hello there,

    I'm currently working on a GUI system for OGL but somehow I got stuck along the way.

    I'm splitting my code up into multiple namespaces, just to keep it organised.
    Now I have a namespace Gui::Controls, in which I will define all my controls.
    In this namespace I have my base class Control, which I need to implement in all my other controls.

    This is my declaration of the Gui::Controls::Control class:
    PHP Code:
    namespace Gui{
        namespace 
    Controls{
            class 
    Control : public Object{
                    ....
                    };
            };
    }; 
    And this is my declaration of the Button control, which needs to implement Gui::Controls::Control:
    PHP Code:
    namespace Gui{
        namespace 
    Controls{
            class 
    Button: public Control{
                    ....
                    };
            };
    }; 
    (Gui::Controls::Control resides in control.h, and Gui::Controls::Button resides in button.h.
    button.h is including control.h.)

    Now this doesn't seem to work as i get the following error:
    Code:
    error C2504: 'Control' : base class undefined
    Any ideas how to solve this?

    Grtz, Tom.

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    10
    Never mind, I found out what I did wrong..
    I forgot to add some closing tags to my namespaces causing them to get messed up.

    Grtz, Tom.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 10-02-2005, 12:27 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM