Mail Archives: djgpp/1997/02/18/04:44:59
Mark wrote:
>Here's my problem...
>(please don't comment on my programming form, I know it needs work)
>
[Code snipped]
>
>As you can see, these two classes are friends of each other.
>This means that each has a reference to the other within its
>definition. Before lindef will mean anything to the compiler,
>the class has to be defined. So I put lindef in front of vertex.
>
>Now, of course, when the compiler gets to vertex, lindef means
>nothing, so I get an error. If I switch them, the same thing will
>happen.
>
>What can I do?
>
>Can you make the compiler do more than one pass?
>
>HELP?
>
>TIA
>
>-Fwec
>
Hi Mark,
Try using a forward declaration (before declaring class vertex) thus:
class lindef;
Which will tell the compiler that a definition will follow and should
get around your problem.
Hope this helps
John
________________________________________________________________
Parallax Solutions Ltd. Tel.: 01203 514522
Stonecourt, Fax.: 01203 514401
Siskin Drive, Web : http://www.parallax.co.uk/~johne
Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk
________________________________________________________________
Remember:
There is no such thing as computer error, it's 100% YOUR fault
________________________________________________________________
- Raw text -