Closed Thread
Results 1 to 3 of 3

Thread: Multiple classes in one namespace

  1. #1
    NeedHelp Guest

    Multiple classes in one namespace

    I'm having problems with one of my projects. I created a windows .net form and want to include more than one namespace in the class. I create the second class after my form class but when I compile it doesn't recognize the data. I get a syntax error (Syntax Error: Identifier accessData) and a undeclared identifier error. If I move the second class to the top everything works but then the designer wont run. How can I use this class or define it before the first class? Here is an example:

    namespace spaceName
    {

    public __gc class Form1 : public System::Windows::Forms::Form
    {
    public:
    Form1(void)
    {
    InitializeComponent();

    }

    ........... Code here

    // Trying to call the second class here:
    accessData* data = new AccessData();


    }; // end the class

    // Create another class
    public __gc clase accessData
    {
    .. Code here
    };
    } // End Namespace

  2. CODECALL Circuit advertisement

     
  3. #2
    RobSoftware is offline Programmer
    Join Date
    Nov 2005
    Posts
    143
    Rep Power
    0
    The first class has to be class derived from the Form. That is why you see a designer error.

    You can do a forward declaration in Form.h to get it to work or simply create a new class file for your project.

  4. #3
    NeedHelp Guest
    Ahh, I see. If I move the first class the designer doesn't work. I've put the class in a seperate file and included it which also works just fine. How do I do a forward declaration?

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 13
    Last Post: 09-09-2011, 09:18 PM
  2. Help, multiple classes + constructors
    By xXAlphaXx in forum C and C++
    Replies: 3
    Last Post: 04-25-2010, 03:11 PM
  3. using namespace std;
    By Hunter100 in forum C and C++
    Replies: 2
    Last Post: 02-12-2010, 05:51 PM
  4. Compile Application Multiple Classes
    By MarkTheSpark in forum Java Help
    Replies: 6
    Last Post: 08-14-2009, 08:02 AM
  5. Compiling an Application with Multiple Classes
    By neophyte in forum Java Help
    Replies: 4
    Last Post: 06-29-2009, 08:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

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