Delphi classes (Was: bugs, incompatibity, function attributes)_(re)

Thu, 3 Jul 1997 11:17:31 +0300 (LDT)


3-Jul-97 01:13 Frank Heckenbach wrote:
>> 4.  Virtual methods to be overridden must be overriden
>> with the "override" directive; the "virtual" directive merely
>> creates a new method (or at least, don't reject the
>> "override" directive in a "Class" definition)
>
>Does this mean you have to use "virtual" for *every* method in Delphi, or
>what is meant by "create a new method"?

In Delphi you can declare a method 'virtual' or 'dynamic' and when you want to
override it in an descendant class, you must do it with 'override' directive.

>> 5. Allow "Published" methods (or at least, don't reject the
>> "published" directive in a "Class" definition).
>
>Is this the same as "public" in C++ (= visible to everyone)? I, personally,
>would prefer "public", "protected" (=visible only to descendants) and
>"private" (=visible only to the type/class itself -- BTW, BP does it a bit
>differently, and extend the visibility of private methods to the whole unit
>it's declared in. I don't see any reason or advantage of this). So, perhaps
>we could allow all those keywords, including "published", in any order, also
>possibly repeated (unlike BP).

In Delphi there are four such directives:

  public    - like in BP - visible for everyone
  private   - like in BP - visible only for this unit (I don't see any
                           advantages too)
  protected - visible for this class and its descendants
  published - same as public, but also accessible at the design time
              (in Object Inspector) - I don't program Delphi, but as I
              remember only properties were placed here.

>> 6. All classes to have the same ultimate ancestor object.
>
>The same discussion as with objects recently... ;-)
>Is this really necessary (if so, for what?), or is it sufficient if all
>classes in a given library use the same ancestor by convention?

I think it's only needed for Delphi compatibility, where TObject is the
ultimate ancestor of all objects. Perhaps another compiler switch (for
Delphi compatibility)?

--
Marius Gedminas
E-mail: mgedmin@pub.osf.lt
WWW: http://www-public.osf.lt/~mgedmin


Marius Gedminas (mgedmin@pub.osf.lt)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es