[DGD] Clarifying private and static function classes

Felix A. Croes felix at dworkin.nl
Fri Jul 3 13:51:01 CEST 2009


Matt Tolton <matt at tolton.com> wrote:

> I've been unable to find any documentation on what private and static
> mean when applied to functions in DGD.  Based on my experimentation:
>
> private -> not virtual, not callable via call_other or by any subclasses
> static -> not callable via call_other, can use it to create a "pure
> virtual" function with prototype in inheritable

A private function declaration can be "virtual" (i.e. prototype-only)
as long as that function is also defined in the same object.

A static function can be called with call_other(this_object(), ...)


> Based on this, it wouldn't ever make sense to declare a function both
> private and static.

You can think of private as implying static.


> This seems to differ from other LPC dialects [1], where private does
> not protect against call_other.

Suppose that objects A and B both have a private function "foo".  C
inherits both A and B.  What function does call_other(C, "foo") call?

Regards,
Felix Croes



More information about the DGD mailing list