Re: abstract sub programs overriding

From: Hyman Rosen (hyrosen_at_mail.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 10:40:02 -0500

Dmitry A. Kazakov wrote:
> No, this is just a contract model.

Between what parties?

> These are different things - to have a bad design or to have a good
> one, but poorly coded one.

You want your language to help you catch the poor coding. That's why
Ada catches bounds errors, for example.

> You cannot do it right if the language does not support object
> construction properly.

The concept of two-phase initialization is a backward step in OO.
The paradigm of C++'s *tor mechanism is that other methods don't
ever need object validity checks, because constructors make the
object kosher.

> I tried to show that the source of the problem is that to construct T
> /= to construct T'Class.

This makes no sense. A general object, in the OO world, may have each
derived class require services from its base class, even during object
construction. Bases may need to invoke services from derived classes,
such as in the template method design pattern. When the latter is
invoked from the former, problems arise. I have no idea what this has
to do with being classwide or not.



Relevant Pages

  • Re: What happens if an exceptions thrown in a derived constructor?
    ... How do the resources allocated in the base class get ... Everything for which construction has already completed (e.g. members ... construction (e.g. the derived class, ... applicable) doesn't get its destructor called. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Require base class member to be populated by derived classes.
    ... But it's not very different from any of the other half-way solutions that had already been suggested (nor was it clear from your post that your requirement was that the "population" happen during construction). ... In all cases, the general idea is: have some code in the derived class that initializes the members, and have some code in the base class that verifies that initialization. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: object relational database versus "inteligent" serialization
    ... You all say it's because base class must initialize its members but I ... construction for that matter, would complicate matters horribly. ... Let _me_ worry about proper initialization. ... But it has one limitation. ...
    (comp.lang.java.programmer)
  • Re: mulitple inheritance and constructors?
    ... > I just tried something with multiple inheritance and I have a problem ... > with the construction of my object. ... > There's a base class Base, ... IIRC in case of virtual inheritance it is *always* the most derived class, ...
    (comp.lang.cpp)
  • Re: method prolog/epilog
    ... Do you mean you want the base class to do some ... of its own contstruction only after the child class is finished ... doing its construction? ... code and I found this trick, I'd recommend getting rid of it. ...
    (comp.lang.cpp)