Re: Hoe to create Singleton objects with GObjects ?

On Tue, Jun 26, 2007 at 04:08:06PM +0100, Emmanuele Bassi wrote:
> On Tue, 2007-06-26 at 16:59 +0200, David Nečas (Yeti) wrote:
> > > 2. Is it possible to create a final class ? (i.e A class which
> > cannot be
> > > derived) in GObjects?
> > 
> > What are the expected performance or security benefits?
> > I would say none.  So why bother?
> declaring a final class is surely not an issue of performance or
> security; it fits with information hiding typical of OOP, so it's a
> perfectly valid question, IMO.

You mistake private data members with nonsubclassable types.

These concepts are normally orthogonal, the fact that by
making the struct private one also makes the type
nonsubclassable in GObject (well, unless I obtain the struct
size somehow) is a side-effect of the implementation,
probably rather unfortunate.

The commonly listed reasons for nonsubclassable types are
performance and security (in languages where final classes
can have any effect on these) -- not encapsulation which is
achieved by other means.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]