1 of 5

Slide Notes

DownloadGo Live

Methods

Published on Feb 02, 2016

No Description

PRESENTATION OUTLINE

Methods

By: Rachel Rector 

What is a method?

  • procedure
  • subroutine 
  • function 
  • linked to a class
Photo by tim caynes

what are methods used for?

  • Communicate with the objects 
  • Have objects within the class carry out tasks 
  • Displaying an address 
  • Opening and closing method for Windows 
  • Displaying information 

How to write a method

  • Start with    function display() {
  • $output .= $this->street_address
  • This recalls the object from the class to output this specific object  
  • The next $output will assign the next object to be outputed
  • Conclude method with     return $output; }
Photo by solofotones

How to make a method work

  • We must define the objects within the class that the method is linked to 
  • This occurs in a php document and is saved as class.blank.inc
  • This is how that looks class Address { var $street_address;
  • Must also create HTML where users can enter information needed to
  • complete the method.