Workshop


The workshop is designed to help you anticipate possible questions, review what you've learned, and begin putting your knowledge into practice.

Quiz

1.

How would you declare a class called emptyClass that has no methods or properties?

2.

How would you choose a name for a constructor method?

Answers

1.

Use the class keyword:

  class emptyClass {   }


2.

You don'ta constructor is named for the class in which it resides.

Activity

Create a class called baseCalc() that stores two numbers as properties. Next, create a calculate() method that prints the numbers to the browser. Finally, create classes called addCalc(), subCalc(), mulCalc(), and divCalc() that inherit functionality from baseCalc() but override the calculate() method and print appropriate totals to the browser.




Sams Teach Yourself PHP, MySQL And Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (3rd Edition)
ISBN: 0672328739
EAN: 2147483647
Year: 2004
Pages: 327

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net