linking objects

This is a discussion on linking objects within the C++ Programming forums, part of the General Programming Boards category; i was wondering if anybody could help me with the syntax for 4 classes to pass messages between each other, ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    5

    linking objects

    i was wondering if anybody could help me with the syntax for 4 classes to pass messages between each other, i can get it to compile but when i run the program the program crashes when it comes time to message pass, i have 4 classes and i am tring to link them through a 5th one, if anybody can help it would be greatly appreciated

  2. #2
    Registered User kitten's Avatar
    Join Date
    Aug 2001
    Posts
    109
    Well in your case, put this-pointer from each 4 classes to be members of the 5th class. Then direct each function call to the proper object.
    Crashing refers to pointer error. So I could quess that you're trying to call object via false pointer value. Hard to tell without knowing your class structure.
    Making error is human, but for messing things thoroughly it takes a computer

  3. #3
    Unregistered
    Guest
    Could you elaborate on that. I have the same problem. This is how I did my code.
    class A {int a;}
    class B {int a; A *output[2];}

    A a[2]; B b[2];
    *b[0].output[0]=a[0];
    *b[0].output[1]=a[1]; ...

    b[0].output[0].a=1;

  4. #4
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Try something like -

    A a[2]; B b[2];
    b[0].output[0]=&a[0];
    b[0].output[1]=&a[1];

    b[0].output[0]->a=1;
    zen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking with two objects
    By emanresu in forum C Programming
    Replies: 2
    Last Post: 11-07-2006, 06:42 AM
  2. Replies: 60
    Last Post: 12-20-2005, 10:36 PM
  3. Linking objects to your C++ projects
    By Dwizard in forum Windows Programming
    Replies: 5
    Last Post: 09-24-2005, 07:11 PM
  4. chain of objects within pop framework help needed
    By Davey in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2004, 10:01 AM
  5. Linking objects internally
    By bennyandthejets in forum C++ Programming
    Replies: 3
    Last Post: 02-25-2004, 01:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21