Thread: Getting classes to reference each other

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I don't see why you would need a class to handle communication between the classes, but maybe that's also because the problem is not very clear to me.

    Maybe another solution:

    Make an abstract class and derive all your classes from it. Then make the arrays being arrays of pointers to that abstract class. So you can let the pointers point to whatever derived class.

    In your methods you can then accept arguments of type abstract class, so your methods don't depend on the specific derived classes. Then you only need to include the abstract class definition and don't depend anymore on the specific derived classes.

    [edit]
    Your solution with MEGACOOL looks a bit like mine, but it has a disadvantage, it needs to know about the other classes. Which makes it depending on the other classes.
    [/edit]
    Last edited by Shiro; 01-04-2003 at 04:47 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. A general quaetion on portability
    By kris.c in forum C Programming
    Replies: 7
    Last Post: 07-20-2006, 03:48 AM
  4. problem with the library
    By kris.c in forum C Programming
    Replies: 21
    Last Post: 07-10-2006, 08:29 PM