9fans archive / 2000 / 05 / 48 /    prev next

From: Tom Duff td@pix...
Subject: [9fans] could plan9 run on PC?
Date: Thu, 4 May 2000 16:48:24 GMT

On May 4,  9:53am, xutao@ee.cornell.edu wrote:
> BTW, another question, Rob Pike in his C programming style said that
> "include files should never include include files"
>
> but how if I met following problem?
>
> I had two classes, wishing to each class has its own head files,
> while one class declares another class as one of its member. so it seems
> unavoidable to include one class header file in another class's head file.

In your program, write:

#include <class-a.h>
#include <class-with-class-a-member.h>

In the documentation for class-with-class-a-member, write:
	You must include class-a.h before class-with-class-a-member.h

Your compiler will tell you when you get it wrong.

-- 
Tom Duff.  Telepathic jazz musicians sometimes communicate without
language.