Feature: Multiple class extensions (and inheritance).
Opened this issue · 0 comments
john-bv commented
Typesharp will allow multilevel inheritance, aka you will be able to inherit multiple classes by abstraction with the as
keyword on super
.
Ex:
class TaxiRides extends Queue<Ride>, Date, Mutex {
public constructor() {
super(); // Queue
super as Date();
super as Mutex();
}
}
// Where queue is:
class Queue<T> {
private next_in_list: T[];
public constructor() {
this.next_in_list = [];
}
public function queue(item: T): void {
this.next_in_list.add(item);
}
public function dequeue(): T? {
return this.next_in_list.shift() || null;
}
}