Programming Methodology – multiple interacting objects Self Sufficient – data is contained and manipulated by object “encapsulated data” - all data is stored within objects, and therefore organised and easily retrievable “protection of data” - access to data is controlled by the object
Modular – used in multiple apps
Talk through defining a class.
Instances of same class – same functionality, different data News article – headline, text, possible images – but differ
Method identified by parentheses
Beginners Guide to Object Orientation In PHP by Rick Ogden for PHPNW09
An object is created by creating a new instance of a class. Objects of the same class have exactly the same functionality, but the properties within the object are what makes them different. Eg. A news article on a website may be an object from a NewsArticle class, but the contents of the article will differ from another news article
Throughout the instance of an object, chances are it will need to reference itself (to get its properties, or call its own methods). In order for an object to reference itself, the variable $this is used in the class.