home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18610 < prev    next >
Encoding:
Text File  |  1992-12-31  |  993 b   |  54 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!spool.mu.edu!agate!ames!sgi!fido!odin!roadrunner.denver.sgi.com!bruceb
  3. From: bruceb@roadrunner.denver.sgi.com (Bruce Bailey)
  4. Subject: Re: class forward ref. in C++
  5. Message-ID: <1992Dec31.211446.20632@odin.corp.sgi.com>
  6. Sender: news@odin.corp.sgi.com (Net News)
  7. Nntp-Posting-Host: roadrunner.denver.sgi.com
  8. Organization: Silicon Graphics, Inc.
  9. References:  <1992Dec31.201340.13142@twisto.eng.hou.compaq.com>
  10. Date: Thu, 31 Dec 1992 21:14:46 GMT
  11. Lines: 41
  12.  
  13. In article <1992Dec31.201340.13142@twisto.eng.hou.compaq.com>,
  14. giangd@gocart.eng.hou.compaq.com (Giang Dao) writes:
  15. |> Dear C++ gurus,
  16. |> I have the following question :
  17. |> 
  18. |> class A
  19. |>   {
  20. |>    ...
  21. |>    B * bptr;
  22. |>    ...
  23. |>   }
  24. |> 
  25. |> class B
  26. |>   {
  27. |>    ...
  28. |>    A * aptr;
  29. |>    ...
  30. |>   }
  31. |> 
  32.  
  33. Can't you just do a forward declaration of B?
  34.  
  35. e.g.,
  36.  
  37. class B;
  38.  
  39. class A
  40.   {
  41.    ...
  42.    B * bptr;
  43.    ...
  44.   }
  45.  
  46. class B
  47.   {
  48.    ...
  49.    A * aptr;
  50.    ...
  51.   }
  52.  
  53. Bruce Bailey (bruceb@denver.sgi.com)
  54.