{ return $numPages; }
function setTitle($Title)
{ $title = $Title; }
Function getTitle()
{ return $title; } }
An explanation of each function from the above example:
· setNumPages($numOfPages) - Used to set the number of pages in the book, this is done through its parameter $numOfPages. The function sets the class variable $numPages to whatever value you supply to it through its parameter $numOfPages.
· getNumPages() - Used to return the number of pages in the book, this is done through the use of the keyword return followed by the variable $numPages - the class variable that stores the value of how many pages there are in the book.
· setTitle($Title) - Used to set the title of the book, this is done through its parameter $Title. The function sets the class variable $title to whatever value you supply to it through its parameter $Title. The variables $Title and $title although spelled the same way, are not the same because their capitalization is different - remember that variable names are case sensitive.
· getTitle() - Used to return the title of the book, this is done through the use of the keyword return followed by the variable $title - the class variable that stores the title of the book.