Function area of class AS3
If I have 2 classes and the first one extends the second, how can the second class call a static function from the first?
package p1 {
class a {
static function a1() {
//do soemthing
}
}
class b extends a {
static function b1() {
//do something else
}
}
}
a.a1(); // this works
b.a1(); // this doesn't work
b.b1(); //this works
+1
a source to share
2 answers
When "B extends A" it is actually not the same as "class B has all the methods and properties of A". Not a class, but an object of class B implements all the properties and methods defined in class A. When you call a static method or property - you are dealing with classes, but not with objects (it is very similar to using a namespace).
ADDED: The only way to solve your problem is to override a1 (args) in class B and call super.a1 (args) inside ... 1 line of code. But it seems to me that you have a problem with a software architect if you can't avoid this kind of use.
+2
a source to share