I have a base class like this
class Base {
public var space:Number;
}
which gets extended by
class Desc extends Base {
override public function set space( space:Number ):void {
//code
}
}
This doesn’t compile. Say, you don’t have control of the base class, what ways is there implement the same thing?
The obvious is create a function setSpace(), but this object is being embedded in an already existing system that use the public space.
Thanks in advance.
Your base class should be defined that way:
And then it can be overriden that way:
Edit:
I missed the part where you say you don’t have control over the base class. In that case, hope that
spaceis defined as a getter/setter (it should be if the class is implemented properly). If not, you’ll indeed have to use a function such asgetSpaceandsetSpace.