Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
john-bv opened this issue Jan 3, 2021 · 0 comments
Open

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

john-bv opened this issue Jan 3, 2021 · 0 comments
Assignees
Labels
Feature This issue or PR contains a new feature. Future This issue or PR is something that will be added in the future. High Priority High profile, important issue that needs to be focused on

Comments

@john-bv
Copy link
Member

john-bv commented Jan 3, 2021

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;
    }
}
@john-bv john-bv added High Priority High profile, important issue that needs to be focused on Feature This issue or PR contains a new feature. Future This issue or PR is something that will be added in the future. labels Jan 3, 2021
@john-bv john-bv self-assigned this Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature This issue or PR contains a new feature. Future This issue or PR is something that will be added in the future. High Priority High profile, important issue that needs to be focused on
Projects
None yet
Development

No branches or pull requests

1 participant