Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active March 28, 2018 16:53
Show Gist options
  • Save rogerwschmidt/63e978d8b7d0b0d330616f01cb8a6e66 to your computer and use it in GitHub Desktop.
Save rogerwschmidt/63e978d8b7d0b0d330616f01cb8a6e66 to your computer and use it in GitHub Desktop.

this and OOP Instructor Notes

Objectives

  • Create a model that includes properties, and actions that on the properties (get/set)
  • Create a simple class with only a constructor
  • Explain what a class is and why they are useful
  • Add methods to a class
  • Explain why getters and setters are useful, and add getters and setters to a class
  • Explain what a static method is, and add a static method to a class

Create a model that includes properties, and actions that on the properties (get/set)

  • As a class, lets model a backhoe, including properties and actions.
  • With your groups, model a house, including properties and actions.

How do you create a simple class with only a constructor

  • On your slate, create a class name Person that has properties fname and lname that are passed in the constructor.

What are classes and why are they useful?

  • With your group discuss what classes are and why they are useful

How do you add methods to a class

  • On your slate, add a method to the Person class named fullName() that returns the properties fname and lname concated.

Why are getters and setters useful, and how do you add them to a class

  • With your group, explain why getters and setters are useful
  • With your group, add getters and setters for fname, lname, and change fullName() to a getter

What is a static method, and how do you add a static method to a class?

  • With your group, explain why static method is useful
  • With your group, add a new property age, create setters and getters, and create a static method named getOldest that takes 2 Person objects and it returns the older Person
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment