Skip to content

Feature: Multiple class extensions (and inheritance). #6

@john-bv

Description

@john-bv

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;
    }
}

Metadata

Metadata

Assignees

Labels

FeatureThis issue or PR contains a new feature.FutureThis issue or PR is something that will be added in the future.High PriorityHigh profile, important issue that needs to be focused on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions