Solution: Mixins

Solution for the "Mixins" Challenge.

We'll cover the following

Solution: Mixins

Implement a new person named ‘student’ who likes to sketch doodles, reads term papers, and runs for 5 miles every day.

Solution #1: Add a new class for Student that implements desired behaviors using Sketching, Reading, and Exercise.

class Student extends Person with Sketching, Reading, Exercise {
}

Solution #2: Use Mixins from the previous lesson to implement student’s behaviors using the following methods: sketchDoodles(), reviewTermPaper(), and powerRun().

  //Sketching doodles 
  sketchDoodles() {
    ...
  }

  //reading term paper
  reviewTermPaper() {
    ...
  }
  
  //daily exercise
  powerRun() {
    ...
  }

Get hands-on with 1400+ tech skills courses.