CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    May 2008
    Posts
    3

    Exclamation Using 1 Class in Multiple Files

    I'm trying to create a class inside a header file so that all my files can access that 1 class and only use that one. This is what I have so far.

    ----------

    Window.h:

    class Window
    {
    public:
    Window();
    ~Window();

    /* FUNCTIONS */
    HWND OpenWindow(LPCTSTR, int, int);

    /* VARIABLES */
    int IsRunning;
    };

    typedef class Window *WINDOW;

    ----------

    Main.h:

    class Main
    {
    public:
    Main();
    ~Main();

    WINDOW GameWindow;
    };

    Main::Main()
    {
    Main::GameWindow = new Window();
    }

    typedef class Main *MAIN;

    ----------

    The above code works and lets me call Main::GameWindow in every file but that's as far as I can go. I can't call Main::GameWindow->OpenWindow(). How do I fix this?
    Last edited by Driklyn; May 25th, 2008 at 10:53 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured