Call Parent Class Methods

Video loading...

Transcript language code: 

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:04
    We covered that when you override a function
  • 0:07
    you override it entirely.
  • 0:09
    In RebelShip, we're overriding getNameAndSpecs,
  • 0:13
    which means that when this method is called on a RebelShip object
  • 0:16
    the getNameAndSpecs inside of the original ship class,
  • 0:20
    i.e. the parent class, is never called.
  • 0:23
    In this case, that's sort of a problem,
  • 0:26
    because it leaves us with all this code duplication.
  • 0:30
    It would be way better if we could somehow call the parent method
  • 0:34
    getNameAndSpecs inside of Ship,
Loading ...