thoughts about BIC
Michael Matz
matz at kde.org
Mon Apr 8 13:49:02 BST 2002
Hi,
On Mon, 8 Apr 2002, Lubos Lunak wrote:
> > > - prevent others from creating instances of the class(no public
> > > constructor, including copy ctor)
> > > - prevent others from subclassing it(not even a protected constructor)
> > > - prevent others from direct access to any data member(you should have
> > > all data members at least protected: anyway), including inlines
> >
> > ... if an instance of such a class A is a member of another class B,
> > extending A will break B by moving it's members just as if you added a
> > member variable in the middle of B. Yes, it's a special case of the above
> > non-instanceability.
>
> But as you say, this is 1) in the list above, so it's no problem.
I wanted to mention it anyway, partly because 1) is a fairly harsh
prerequisite. Instanciating class A on the stack or heap is perfectly
fine, even if A is extended by some members. It's just non-final usage,
i.e. as base class or as member, which makes problems.
Ciao,
Michael.
More information about the kde-core-devel
mailing list