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

adding ability to pass classical inheritance object #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Sep 13, 2018

  1. adding ability to pass classical inhertiance object

    adding ability to pass classical inhertiance object
    
    ```
    co(function* () {
      function Human(name, age) {
        this.name = name;
        this.age = age;
      }
    
      Human.prototype.getName = function() {
        return this.name;
      };
    
      Human.prototype.getAge = function() {
        return this.age;
      }
    
      let Asian = function(name, age) {
        Human.call(this, name, age);
        this.country = 'Brunei';
      }
    
      Asian.prototype = Object.create(Human.prototype);
    
      let agus = new Asian('Agus', 29);
    
      let res = yield agus;
      console.log(typeof res);
      console.log(res); // { name: 'Agus', age: 29, country: 'Brunei' }
      console.log(res.getName()); // Agus
      console.log(res.country); // brunei
    })
    .catch(function(e) {
      console.log(e);
    });
    
    ```
    teknosains committed Sep 13, 2018
    Configuration menu
    Copy the full SHA
    1cb244e View commit details
    Browse the repository at this point in the history