W3C home > Mailing lists > Public > www-lib@w3.org > April to June 1996

Re: [Q] Constructors/Destructors

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Wed, 15 May 1996 12:48:54 -0400
Message-Id: <199605151648.MAA01682@www20.w3.org>
To: sacha@clip.dia.fi.upm.es (Sacha)
Cc: www-lib@w3.org
Sacha writes:
> Hi,
> Why are constructors PUBLIC but destructors (X_delete(X* this))
> PRIVATE? What is there stopping me from declaring everything

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:47 UTC