Circular classes

This is a discussion on Circular classes within the C++ Programming forums, part of the General Programming Boards category; I've got a game that simulates an american football season and I have many classes over several header files. The ...

  1. #1
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728

    Circular classes

    I've got a game that simulates an american football season and I have many classes over several header files. The problem is that a lot of my objects need each other but the compiler NEEDS to define one of them first. An example, I've got these three classes all in different header files: a team class which contains a gamelist, a gamelist class class which contains games, and a games class which contains two teams. This is just one example, is there any way to do this w/o putting eveything into one header file and forward declaring? Forward declaring doesn't seem to work for different header files....

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Thanks, that website helped me rethink my design - I wished my school taught more about Object Oriented design, and not just the syntax!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  2. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 08:04 AM
  3. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  4. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 04:38 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM

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