Haxe Code Cookbook
Haxe programming cookbookPrinciplesInheritance

Inheritance

Reading time: 0.5 minute

Classes inherit from other classes using the extends keyword:

class Point2d {
  public var x:Int;
  public var y:Int;

  public function new(x, y) {
    this.x = x;
    this.y = y;
  }
}

class Point3d extends Point2d {
  public var z:Int;

  public function new(x, y, z) {
    super(x, y);
    this.z = z;
  }
}

Interfaces can also extend

interface Debuggable extends Printable extends Serializable

Contributors:
Last modified:
Created:
Category:  Principles
Tags: