Re: dynamic object creation



On Fri, 28 Oct 2005 11:41:17 +0200, "B.r.K.o.N.j.A."
<thebrkonja@xxxxxxx> wrote:

>All classes are descendent of one base class, they have no new methods just
>different implementations of base ones. Basicaly I need to get different
>calculation object according to value stored in database.

>Does this simplify things?

It certainly changes things.

Which comes first the Object or the thing in the database ?

My hunch is the thing in the database

Are you after something like:

ABaseClass := TSomeClass.Create( FlagFromDataBase );

ABaseClass.DoCalcs;

Where ABaseClass contains some descendant of TBaseClass ?

A bit like passing some descendant of a TStream down to a procedure,
but the other way round. ??


.



Relevant Pages

  • Re: Language enhancements
    ... A base class that provides a virtual method must account for that in its ... If you find it necessary, in creating a descendant, to nullify ... code implemented by the ancestor, then that code should not be in the ... Same applies to contracts; descendants should not break ancestor contracts, ...
    (borland.public.delphi.non-technical)
  • Re: How to create an instance of a class by class name in a string?
    ... > I have an application that has one base class and several descendant ... classes (13 ÷classes and the class name in a String. ... var descendantclass:tcbase; ...
    (comp.lang.pascal.delphi.misc)
  • Re: "All public methods should be virtual" - yes or no / pros & cons
    ... >> of stating that a base class is not changed by the descendant? ... polymorphism as an event mechanism. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Language enhancements
    ... Everything that is true for a base class should be true ... > Hmm. ... A descendant methods can easily return dfferent results for the ... "plugin site"), but in this case again, any tests at the ancestor level ...
    (borland.public.delphi.non-technical)
  • Re: Unlinked relatives - what to do?
    ... Thinking of visiting your ancestral shtetls? ... Keep it around in your main database and add a note, ... because I expect only a descendant to find it since ... Zev Griner ...
    (soc.genealogy.jewish)