I think you should use composition in this case, not inheritance.
--
Pedro Taranto
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to
Hi Hans,
'super' refers to the instance, but your static _test isn't part of
the instance, it is part of the class (technically, of the constructor
function). Imagine it as this.prototype.prototype, although it
technically isn't the same (well, maybe it is, I haven't tested it).
It behaves like
Hi Pedro,
the question is not about what is the best approach :), but about 'why the
heck isnt this working?'.
From a programming point of view my example is bad practice anyway
greetz
JC
On 8/20/07, Pedro Taranto [EMAIL PROTECTED] wrote:
I think you should use composition in this case, not
Hi Mark,
why is it static? Its declared as private var not as private static var?
(if i remove super it works fine btw and for different instances with
different values).
greetz
JC
On 8/20/07, Mark Winterhalder [EMAIL PROTECTED] wrote:
Hi Hans,
'super' refers to the instance, but your
Looks like you forgot to actually extend the superclass, try
class SubClass extends superclass {
- Benny
-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Hans Wichman
Verzonden: maandag 20 augustus 2007 13:51
Aan: Flashcoders mailing list
Onderwerp:
Hi Benny,
Sorry, copy paste error, of course the subclass looks like: subclass
extends superclass etc
:)
Still no go :)
greetz
JC
On 8/20/07, Benny [EMAIL PROTECTED] wrote:
Looks like you forgot to actually extend the superclass, try
class SubClass extends superclass {
- Benny
=1337.html
Greetz
Benny
-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Hans Wichman
Verzonden: maandag 20 augustus 2007 15:40
Aan: flashcoders@chattyfig.figleaf.com
Onderwerp: Re: [Flashcoders] accessing super fields
Hi Benny,
Sorry, copy paste
Hans Wichman wrote:
lets say i have a superclass:
class SuperClass {
private var _test:String = null;
}
and a subclass:
class SubClass {
private function _testFunction () {
super._test = foo;
trace (super._test);
}
}
this traces undefined.
If I remove the super.
Hi,
okay thanks that comes as closest to an explanation as I'd like I
guess, but.
If I declare a method test() in superclass, i can call it from the subclass
using super.test().
Whether I have overwritten it or not.
So why doesnt the same go for fields.
I think its a bug to be honest.
As
As Benny said, you dont need to, no i know! But appearantly it works
different for fields than for methods.
It actually doesn't work *different* but it doesn't work *per design* for
fields.
The docs (see the link I provided) clearly state that it is only supported
with methods. There is no
sorry i missed that part, thanks benny:)
On 8/20/07, Benny [EMAIL PROTECTED] wrote:
As Benny said, you dont need to, no i know! But appearantly it works
different for fields than for methods.
It actually doesn't work *different* but it doesn't work *per design* for
fields.
The docs (see
On 8/20/07, Hans Wichman [EMAIL PROTECTED] wrote:
Hi Mark,
why is it static?
Uhm... because I didn't read properly, sorry. :/
Its declared as private var not as private static var?
I could swear it read 'static var' when I first read the mail. Now you
made Gmail change it some how. :)
Hans Wichman wrote:
okay thanks that comes as closest to an explanation as I'd like I
guess, but.
If I declare a method test() in superclass, i can call it from the
subclass
using super.test().
Whether I have overwritten it or not.
So why doesnt the same go for fields.
I think
Hans Wichman wrote:
Hi,
okay thanks that comes as closest to an explanation as I'd like I
guess, but.
If I declare a method test() in superclass, i can call it from the subclass
using super.test().
Whether I have overwritten it or not.
So why doesnt the same go for fields.
Think
In as3, variables (properties and methods) that are private are not visible
to subclasses, protected are accessible with this and super (as should be),
and public are accessible with this and super too (kind of obvious). as3
definitely rocks when it comes to variable scoping.
On 8/20/07, Mark
yep they should have copied that from java years ago :))
On 8/20/07, elibol [EMAIL PROTECTED] wrote:
In as3, variables (properties and methods) that are private are not
visible
to subclasses, protected are accessible with this and super (as should
be),
and public are accessible with this
well just to be clear, i wasnt planning on overriding _test :) the example
was bad enough practice in itself.
It was more about a readability issues, like some like to do this. etc for
every variable.
On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote:
Hans Wichman wrote:
Hi,
okay thanks
Seems to perfect sense in as3...
On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote:
Hans Wichman wrote:
Hi,
okay thanks that comes as closest to an explanation as I'd like I
guess, but.
If I declare a method test() in superclass, i can call it from the
subclass
using
make*...
On 8/20/07, elibol [EMAIL PROTECTED] wrote:
Seems to perfect sense in as3...
On 8/20/07, Ron Wheeler [EMAIL PROTECTED] wrote:
Hans Wichman wrote:
Hi,
okay thanks that comes as closest to an explanation as I'd like I
guess, but.
If I declare a method
Hans Wichman wrote:
yep they should have copied that [private and protected] from java years
ago :))
Or from C++ years before Java was born ^_^
Cordially,
Kerry Thompson
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or
20 matches
Mail list logo