Download presentation
Presentation is loading. Please wait.
Published byMyles Harmon Modified over 9 years ago
1
What is Object-Oriented Programming?
2
Objects – Variables and Logic inside "Objects", not standalone code – Objects contain related variables and functions Key Concepts – Encapsulation – Inheritance – Polymorphism
3
Key Terminology – Functions defined in an Object are called "Methods" – Variables defined within an Object (not inside functions) are called "Properties" of the Object – An Object is built (or instantiated) from a "class" that defines what is contained in an Object – A class can inherit properties and methods from another class – An abstract class can be inherited by another class, but not instantiated – An interface can contain constants and method definitions that can be implemented by other classes
4
A Simpler Way To Think About Object-Oriented Programming "Objects are defined by a meaningful name that keeps related functions and variables together in one place" Example: – A Payroll object would contain a variable holding a check number and a function that would calculate the withholding tax on a paycheck – Payroll>checkNumber – Payroll>calcWithholdingTax()
5
What's Missing in PHP compared to other OOP Languages? – PHP's data weakly typed – PHP's objects are not explicitly typed No object detection (polymorphism problem) – No way to instantiate an object of one type into an object of a supertype – Functions do not enforce a particular data type that must be returned
6
End of Presentation
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.