GoConqr has a new look! Let us know what you think.

Mind map

class Tiger

Deleted user User has deleted their subject information English

Map content

class Tiger

  • This is the tiger upper class. All the properties that we are going to define here inside this constructor will be passed or bequeathed to either object that will use this class as a constructor or to subclasses (bengal tigers, siberian tigers) that extend this class. For example here we are going to define 3 properties that all the Tigers, regardless of species have. Some of them may be common, like the species, which is tiger almost the whole time, but then things change like the color of the fur, the region of living, the color of their eyes, and if they eat meet or not.  Properties are going to be the same but the values not. Practically: class Tiger {        constructor(furColor, region, eyeColor, eatMeet) {                 this.furColor = furColor;                 this.region = region;                 this.eyeColor = eyeColor;                 this.eatMeet = eatMeet;                 this.species = 'Tiger';        } }
  1. Class Bengal Tiger

    • This is the Bengal Tiger class. This class inherits all the properties of the tiger class. As we have seen in the example before,this class extends the Tiger class. Additionally, keep in mind that we want to specify in the super function the values that every Bengal Tiger will have and inherit,  and also create the new ones for every unique Bengal Tiger that is going to be created from this subclass afterwards. So the Bengal Tiger will have a super function inside it's constructor. Practically that means:  class BengalTiger extends Tiger {         constructor(name, age) {               super('orange-black',  'India',  'gold',  true);               this.name = name;               this.age = age;         } }
    • Richard Parker Object
      • This is the final literal object, that inherits from the Bengal Tiger class. So in order to do it practically we have:  let richardParker = new BengalTiger('Richard Parker', 15); 
    • Jack Sparrow Object
      • This is the final literal object, that inherits from the Bengal Tiger class. So in order to do it practically we have:  let jackSparrow= new BengalTiger('Jack Sparrow', 12); 
  2. Class SiberianTiger

    • This is the SiberianTiger class. This class inherits all the properties of the tiger class. As we have seen in the example before,this class extends the Tiger class. Additionally, keep in mind that we want to specify in the super function the values that every Bengal Tiger will have and inherit,  and also create the new ones for every unique Siberian Tiger that is going to be created from this subclass afterwards. So the Siberian Tiger will have a super function inside it's constructor. Practically that means:  class SiberianTiger extends Tiger {         constructor(name, age) {               super('white-black',  'Siberia',  'blue',  false);               this.name = name;               this.age = age;         } }
    • Night's King
      • This is the final literal object, that inherits from the Siberian Tiger class. So in order to do it practically we have:  let nightKing= new SiberianTiger('Nightking', 1200);
    • Jon Snow
      • This is the final literal object, that inherits from the Siberian Tiger class.  So in order to do it practically we have:  let jonSnow= new SiberianTiger('Jon Snow', 25);

Information

Description
A mind map that describes how the class based inheritance works in ES6
Created by
Deleted user · Feb 2019
Updated
Feb 25, 2019
Views
255
History
  • Created by Kostas Diakogiannis · Nov 22, 2018
  • Copied by Kostas Diakogiannis · Feb 25, 2019
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?