Page 205 - Open Soource Technologies 304.indd
P. 205
Unit 8: Objects
Object: Object is a specific instance of a class; it contains real values instead of variables. Notes
Serialization: Serialization is the process of converting a data structure or object state into a
format that can be stored and “resurrected” later in the same or another computer environment.
Visibility: Visibility allows you to control where your class members can be accessed from, for
instance to prevent a certain variable to be modified from outside the class.
1. Develop a PHP program for object introspection functions.
2. Develop a PHP program to show the example of abstract class.
8.10 Review Questions
1. What are the basics of objects? Explain in detail.
2. What are the terminologies used in PHP? How the PHP terms are different from other
languages?
3. How do we create an object in PHP? Explain with example.
4. What do you mean by methods and properties? How does it access in PHP?
5. What is the class in PHP? What is its use in programming?
6. What is the difference between constructor and destructor? Explain with example.
7. Explain the difference between visibility and inheritance.
8. What is the difference between abstract classes and static classes?
9. Why we use final keyword? Explain with example.
10. What do you mean by introspection? Explain.
11. What do you mean by serialization? Explain with example.
12. What is the difference between serialization and deserialization?
Answers to Self Assessment
1. (c) 2. (d) 3. (d) 4. (a) 5. (c)
6. (c) 7. (c) 8. (b)
8.11 Further Readings
Object-oriented PHP: Concepts, Techniques, and Code, by Peter Lavin.
Core PHP Programming, by Leon Atkinson, Zeev Suraski.
http://php.net/manual/en/function.is-object.php
http://www.w3schools.com/php/php_intro.asp
LOVELY PROFESSIONAL UNIVERSITY 199