On 1/17/06, Morten Barklund Shockwaved <[EMAIL PROTECTED]> wrote:
> Nope, when you call the static method, it will not change when
> subclassed. That is exactly as I would expect.
>
> This is due to the fact, that static methods aren't inherited - they do

So you're saying that since B doesn't have a class method doit(), only
the parent of B, A has the class method doit, saying B.doit() will
generate an error? Calling B.doit() works for me. B is inheriting the
class method doit() from A.

> ... they do
> not exist on instances.

To me, that doesn't make sense. But I'll leave that for another day as
I'm NOT instantiating the the class, I'm calling the class methods
directly.

> ...  They only exist on the class itself. When you
> call a static method or refence a static variable, that path to the
> variable or method will be "hardcoded" in front of the name of the
> member and thus not change when subclassed.

If what you are saying true, then calling a class method of class that
is only defined in the parent will fail. I'm seeing that it works, at
least it works for me.

> I would also expect this behaviour. Consider static methods as though
> they existed in a totally different class. If class A refenced a method
> of class C, then just because A was subclassed into B, B still refers to
> class C - what else should it do?

Honour the heritance tree which is what seems to be happening when you
call a class method on B that is only defined in B's parent A..



Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
www.flashdev.org.au
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to