[comp.sys.mac.programmer] C++ 3.1 dump/load problems

bowman@reed.UUCP (Eric Bowman) (02/01/91)

Well, after waiting months for the final C++ 3.1, I seem to have found a
bug which renders the header file dump/load useless.

Or perhaps I'm doing something wrong...

Here's a brief summary of the situation:

Parent class: TDocument : public HandleObject (abstract class)
inherited class: ParamsDoc : public TDocument (also an abstract class)

My program compiles (quickly!) using the -load option, until it comes
to the ParamsDoc.cp file.  CFront dies with the following message:

File "ParamsDoc.cp"; line 28 # error:  
	ParamsDoc::~ParamsDoc() cannot access __dl : 
	HandleObject  is a private base class

line 28 is:

24:	ParamsDoc::~ParamsDoc()
25:	{
26:		if (otherDoc) delete otherDoc;
27:		if (theInfo) delete theInfo;
28:	}

The class declarations are as follows:

class TDocument : public HandleObject {

protected:
	WindowPtr	fDocWindow;
	[protected data, plus some virtual, non-pure member functions]

public:
	[some public data]

	TDocument();
	virtual ~TDocument();		// our destructor - disposes of window

	[a bunch of virtual (pure & non-pure) & non-virtual member functions]
};

class ParamsDoc : public TDocument {

protected:
	[more protected data]

public:
	[some more data]

	ParamsDoc();
	virtual ~ParamsDoc();

	[some member functions, some virtual, some not, no pure virtuals]
};

What's going on here?  Why does it compile, and run, *just fine* without
precompiling the headers?

Grumble Grumble Grumble

Thanks to anyone with some ideas,

bobo
bowman@reed.{bitnet,UUCP,edu}
...!tektronix!reed!bowman

MUGGC@CUNYVM.BITNET (AGS) (02/07/91)

Assuming you are deriving from MacApp's TDocument, why would you need
a destructor? TDocument::Close closes a document's windows; you could
override it to provide additional actions peculiar to your class.

Alexander Smith
Music
Class of '?? (grad students are classless -- or in a class by themselves?)