Re: [Q] Constructors/Destructors

Sacha writes:
> 
> Hi,
> 
> Why are constructors PUBLIC but destructors (X_delete(X* this))
> PRIVATE? What is there stopping me from declaring everything
> PRIVATE?

This is only the case for streams. The reason is that the stream constructor 
creates a stream object which has a set of methods, for example flush, 
put_character, and free. The methods are assigned dynamically using the 
pointers the function instead of the function names directly. Therefore, the 
external world only has to know the constructor - the other methods are part 
of the stream object as defined in HTStream.h. If you don't have to use the 
stream externally, then you can make the constructor PRIVATE as well.


-- 
Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA

Received on Wednesday, 15 May 1996 12:48:57 UTC