class Tiger

Descripción

A mind map that describes how the class based inheritance works in ES6
Kostas Diakogiannis
Mapa Mental por Kostas Diakogiannis, actualizado hace más de 1 año
Kostas Diakogiannis
Creado por Kostas Diakogiannis hace alrededor de 6 años
20
0

Resumen del Recurso

class Tiger

Nota:

  • 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

    Nota:

    • 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;         } }
    1. Richard Parker Object

      Nota:

      • 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); 
      1. Jack Sparrow Object

        Nota:

        • 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

        Nota:

        • 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;         } }
        1. Night's King

          Nota:

          • 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);
          1. Jon Snow

            Nota:

            • 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);
          Mostrar resumen completo Ocultar resumen completo

          Similar

          Classes and Objects Quiz
          joannazhang13
          Quiz - Object Oriented Javascript
          arunram.krish
          Label the Classroom
          Robert Caceres
          OOP (Object Oriented Programming)
          Adam Cook
          Examen Fundamentos Basicos de Programación
          Jose Valderrama0721
          Test I. Introduction to web technologies
          Angel Martínez Rodriguez
          Unit 2 - Key Vocabulary
          Shannon Anderson-Rush
          JavaScript Fundamentals
          Andrew Watters
          Front-End Web Development
          Chanthy Ngin
          Javascript - Quiz - Jan 2016
          arunram.krish
          OpenSource Programming
          Faheem Ahmed