It's just a question of only allowing an object factory to create objects
of the specified type.
/pwm
On Fri, 27 Jun 2008, Robert Alatalo wrote:
> If you make the constructor private then you will need to create a
> friend to invoke it. Why would want to not allow another class to
> include your class as a base class? The best you can really do is
> make all the methods private which would negate most of the reasons
> for using it as a base class. I won't say never, but it's generally
> a bad idea to make all of your constructors private though you can
> make some of them private if you like... but that means your class
> needs to be able to invoke them, either directly or via a public
> static class function.
>
> -Robert
>
> On Fri, Jun 27, 2008 at 6:53 AM, Per Westermark <pw...@ia...> wrote:
> > In some situations it can be an idea to make the constructor private.
> >
> > /pwm
> >
> > On Fri, 27 Jun 2008, Lloyd wrote:
> >
> >> Hi,
> >> Is there any mechanism in C++ which stops others from inheriting a
> >> class?
> >>
> >> Thanks,
> >> Lloyd
> >>
> >>
> >>
> >> ______________________________________
> >> Scanned and protected by Email scanner
> >>
> >> -------------------------------------------------------------------------
> >> Check out the new SourceForge.net Marketplace.
> >> It's the best place to buy or sell services for
> >> just about anything Open Source.
> >> http://sourceforge.net/services/buy/index.php
> >> _______________________________________________
> >> Dev-cpp-users mailing list
> >> Dev...@li...
> >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >>
> >
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
|