Code Monkey home page Code Monkey logo

phase-1-super-lab's Introduction

Super Lab

Learning Goals

  • Practice using super to extend child class functionality

Introduction

In this lab we're going to practice the two most common usages of the super keyword.

Instructions

Define a Tree class that will act as our parent:

  • A Tree instance should take in one parameter when created, species, and assign this to a property named species.
  • A Tree should have a static method, definition(), that returns a short definition of all trees:
A tree is a perennial plant with an elongated stem, or trunk, supporting branches and leaves.

Define a Deciduous class that extends Tree:

  • A Deciduous instance takes two parameters, species and name. Use super() in the constructor to use the parent class constructor to assign species. After super(), assign the name parameter to the a name property in the Deciduous constructor
  • Create a static method, definition(), that uses super to access definition() from Tree and add the following to the provide a specific definition for Deciduous:
Deciduous trees shed their leaves annually.

Define a Evergreen class that extends Tree:

  • An Evergreen instance takes two parameters, species and name. Use super() in the constructor to use the parent class constructor to assign species, then assign name to a property in the Evergreen constructor
  • Create a static method, definition(), that uses super to access definition() from Tree and add the following to the provide a specific definition for Evergreen:
Evergreens keep their leaves all year round.

Resources

phase-1-super-lab's People

Contributors

maxwellbenton avatar lizbur10 avatar drakeltheryuujin avatar dependabot[bot] avatar jlboba avatar ihollander avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.