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

Please add fastClass inheritance compharison #2

Open
dotnetwise opened this issue Mar 25, 2013 · 2 comments
Open

Please add fastClass inheritance compharison #2

dotnetwise opened this issue Mar 25, 2013 · 2 comments

Comments

@dotnetwise
Copy link

Please add fastClass https://github.com/dotnetwise/Javascript-FastClass with its goods and bads as you have fairly reviewed other peers as well.
As for the record it does support private methods if it is used like this

var A = function (val) {
    this.val = val;
}.define({
    method1 = function (x, y, z) {
        this.x = x;
        this.y = y;
        this.z = z;
      }
});

var B = A.fastClass(function (base, baseCtor) {
        function privateMethod(z) { 
            this.z = "some private value" + z;
        }

    return function () {
        this.constructor = function (val) { baseCtor.call(this, val) },
        this.method1 = function (y, z) {
            base.method1.call(this, 'x', y, z);
                        privateMethod.call(this, z);
        }
    };
});

var b = new B("b");
b.method1("y", "z");
b.z; //"some private value z"
@njoubert
Copy link
Owner

When I wrote this originally, TypeScript wasn't out yet, but yes when I have the time I'll update this.

@dotnetwise
Copy link
Author

Sorry, by mistake I have saved the same issue twice. I have re-edited the issue so you can include my fastClass inheritance with its pros and cons among the others.

@njoubert njoubert reopened this Mar 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants