Deprecated: Function create_function() is deprecated in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/plugins/wp-automatic/wp-automatic.php on line 70
JavaScript 6 03: Inheritance | D4mations.com
  • Sunday , 28 February 2021

JavaScript 6 03: Inheritance

Code Canyon



In this video we go over how to inherit from classes (polymorphism) and we also go over how to override methods and call base methods.

Twitter โ–บ https://twitter.com/ShieldCrush
Instagram โ–บ https://www.instagram.com/BrentFarris

Original source

3d Ocean

Related Posts

9 Comments

  1. Jamoliddin Fakhriddinov
    March 9, 2018 at 10:17

    Brent Farris you are the best! Thanks a lot!!!

  2. Jochem Stoel
    March 9, 2018 at 10:17

    You shouldn't call super.constructor, you need to simply call super.

    class Person {
    constructor(name, age) {
    super(name)
    this.age = age
    }
    }

    Also some advice for your coding style: stop using semi colons

  3. mounaim zaryouhi
    March 9, 2018 at 10:17

    Thanks Brent ๐Ÿ™‚
    Could you please explain why I'm getting this error :
    VM656:3 Uncaught ReferenceError: this is not defined(โ€ฆ)SpecialCrazyDev @ VM656:3(anonymous function) @ VM822:1InjectedScript._evaluateOn @ VM103:145InjectedScript._evaluateAndWrap @ VM103:137InjectedScript.evaluate @ VM103:118
    var specialDevvv = new SpecialCrazyDev("UI dev",20);

    This is my code :
    class CrazyDev{

    constructor(job){
    this.job = job;
    }
    toString(){
    return "My job is " + this.job;
    }
    }

    class SpecialCrazyDev extends CrazyDev{
    constructor(job,age){
    super.constructor(job);
    this.age=age;
    }

    toString(){
    return super.toString() + "I am a special crazy dev, I'm " + this.age+" years old !!";
    }
    }

  4. SadakaTV
    March 9, 2018 at 10:17

    class human {
    contructor(name){
    this.nm = name;
    }

    toString(){
    return "Hello, my name is" + this.name + ".";
    }
    }
    class enfant extends human{constructor(name, age){super.constructor(name); this.ag = age;} toString(){ return super.toString() + "im i human im enfant and my age is = "+ this.ag ; } }
    undefined
    var lolo = new enfant("mopi", 45);
    ReferenceError: |this| used uninitialized in enfant class constructor

  5. tjon 90
    March 9, 2018 at 10:17

    Thanks Brent! This is extremely helpful!

  6. Abhijeet Kurle
    March 9, 2018 at 10:17

    Got Error: |this| used uninitialized in Person class constructor
    on line: super.constructor(name) but replaced with super(name)
    got It.
    Anyway Thnks a lot

  7. ravi kanth
    March 9, 2018 at 10:17

    Nice video, thanks!!

    When I tried your example… i get |this| not initialized in class constructor error, for the creation of Person object.

    It worked after changing it to super(name); instead of super.constructor(name).
    Do you know what this might be… I'm sure that I have latest firefox nightly build

  8. Orel Ohayon
    March 9, 2018 at 10:17

    Great video thanks! please upload more stuff ๐Ÿ™‚

  9. iOSX Developer
    March 9, 2018 at 10:17

    Nice, thanks!

Leave A Comment

You must be logged in to post a comment.