Is there a way in Haxe to get the equivalent of Java's abstract methods and abstract classes?
What I want is
// An abstract class. (Written in a Java/Haxe hybrid.)
abstract class Process<A> {
public function then<B>( f : A -> Process<B> ) : Process<B> {
var a : A = go() ;
return f(a) ;
}
abstract public function go( ) : A ;
}
// A concrete class.
class UnitP<A> extends Process<A> {
var _a : A ;
public function new( a : A ) {
_a = a ; }
public override function go() : A { return _a ; }
}
The closest I've been able to get is to define Process
as an interface and to implement it with a conceptually abstract class ProcessA
, which defines both methods; the implementation of go
in ProcessA
simply crashes. Then I can extend my conceptually concrete classes off ProcessA.
go
in a concrete class or if I instantiateProcessA
. – Anemia