Interacting PHP Objects

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:03
    with Leanna Pelham
  • 0:05
    Since the goal of our app
  • 0:07
    is to let two ships fight each other,
  • 0:09
    things are getting interesting.
  • 0:11
    For example, we could fight myShip against otherShip
  • 0:15
    and see who comes out as the winner.
  • 0:18
    But first, let's imagine we want to know whose strength is higher.
  • 0:23
    Of course, we could just write an if statement down here
  • 0:25
    and manually check my ship strength against other ship.
  • 0:29
    But we could also add a new method inside of the ship class itself.