Prev | Current Page 246 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Also, in this example the entire Animal class is abstract and cannot be
instantiated because it does not contain a constructor at all.
Static Fields, Instance Variables, and Inheritance
Static fields are not inherited and, thus, cannot be overridden because they are not part of the class
prototype. Instance variables are inherited but cannot be overridden.
In the case of static functions, this does not mean that a descendant class can ??™ t declare a function already
existing in one of its ancestors. Simply, the two are completely unrelated in their signature; it does not
exist in any super identifier for static functions.
Instance variables are always referenced using the this prefix (or nothing if there is no ambiguity),
regardless if they were declared in the current class or in any of its ancestors.
Inheritance Roles
When considering the inheritance hierarchy, it ??™ s easy to figure out that the same instance can play
different roles at the same time. Considering an instance of the BlogEntry class, it is at the same time an
object representing a blog post and a more generic entry entity .


Pages:
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258