Prev | Current Page 241 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

To do so a new
function with the same signature as the original (same access modifier, same name, same arguments, and
same return type) is declared in the subclass.
To highlight that an already existing method has been redefined, the override modifier can be added in
the function declaration just before the function keyword.
The haXe compiler accepts an - override switch; when this switch is on, the compiler will throw an
error whenever an overridden function without the override keyword is encountered. Leaving this
switch always on is considered a good practice and helps to spot conflicting names.
The BlogEntry and Article classes are now identical and share the same exact methods. What may
distinguish the two is that Article represents a content, which is not a daily journal but more than an
organic and detailed text ??” something the author has possibly dedicated much energy to and can take
profit from a carefully planned publication. For this purpose the new method publishOn is added and
will accept an arbitrary date of publication.


Pages:
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253