SlideShare a Scribd company logo
Beginning PHP
      Session #7
   January 12, 2011
      Josh Butts
Agenda

• More OOP
• Database Object
• Update Vanity with Objects
Inheritance
• Objects can inherit behavior and default
  state from other objects
• A class that inherits from another class is
  called a sublcass
• When we subclass something, we “extend”
  it
• Subclasses may add or change functionality
PHP’s Single Inheritance


• A class may have only one parent class
• Any given class can have many subclasses
Single Inheritance
           Person




           Student




     Honors     Exchange
     Student     Student
Visibility

• Public - anyone can call a method or modify
  a property
• Protected - only this class or subclasses
  may call the method or modify the
  property
• Private - only this class may modify or call
Why use non-public?


• Getters & Setters can inject behavior
• Protects unrelated code from changing
  your state

More Related Content

What's hot

power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oopsDhiraj Kumar
 
Introduction to oops
Introduction to oopsIntroduction to oops
Introduction to oops
Umamaheshwariv1
 
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
Muhammad Hammad Waseem
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
AnsgarMary
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
Nuha Noor
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
Muhammad Hammad Waseem
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
Sabith Byari
 
Packages
PackagesPackages
Packages
Nuha Noor
 
Introduction what is java
Introduction what is javaIntroduction what is java
Introduction what is java
sanjeeviniindia1186
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
teach4uin
 
Itpfldap aug2016
Itpfldap aug2016Itpfldap aug2016
Itpfldap aug2016
Mark Cairney
 
More oop in java
More oop in javaMore oop in java
More oop in java
SAGARDAVE29
 
Lec02 primitive types
Lec02   primitive typesLec02   primitive types
Lec02 primitive types
Asif Shahzad
 
Java01
Java01Java01
Java01
Remon Hanna
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
mosewoodward24
 

What's hot (16)

power poitnt of oops
power poitnt of oopspower poitnt of oops
power poitnt of oops
 
Introduction to oops
Introduction to oopsIntroduction to oops
Introduction to oops
 
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
 
Introduction to oop and java fundamentals
Introduction to oop and java fundamentalsIntroduction to oop and java fundamentals
Introduction to oop and java fundamentals
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Packages
PackagesPackages
Packages
 
Introduction what is java
Introduction what is javaIntroduction what is java
Introduction what is java
 
L5 classes, objects, nested and inner class
L5 classes, objects, nested and inner classL5 classes, objects, nested and inner class
L5 classes, objects, nested and inner class
 
Itpfldap aug2016
Itpfldap aug2016Itpfldap aug2016
Itpfldap aug2016
 
Java file paths
Java file pathsJava file paths
Java file paths
 
More oop in java
More oop in javaMore oop in java
More oop in java
 
Lec02 primitive types
Lec02   primitive typesLec02   primitive types
Lec02 primitive types
 
Java01
Java01Java01
Java01
 
RIBBUN SOFTWARE
RIBBUN SOFTWARERIBBUN SOFTWARE
RIBBUN SOFTWARE
 

Viewers also liked

Fall 2011 PHP Class - Session 2
Fall 2011 PHP Class - Session 2Fall 2011 PHP Class - Session 2
Fall 2011 PHP Class - Session 2jimbojsb
 
GeekAustin PHP Class - Session 6
GeekAustin PHP Class - Session 6GeekAustin PHP Class - Session 6
GeekAustin PHP Class - Session 6jimbojsb
 
Geek Austin PHP Class - Session 1
Geek Austin PHP Class - Session 1Geek Austin PHP Class - Session 1
Geek Austin PHP Class - Session 1jimbojsb
 
Austin NoSQL 2011-07-06
Austin NoSQL 2011-07-06Austin NoSQL 2011-07-06
Austin NoSQL 2011-07-06jimbojsb
 
Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1jimbojsb
 
Geek Austin PHP Class - Session 2
Geek Austin PHP Class - Session 2Geek Austin PHP Class - Session 2
Geek Austin PHP Class - Session 2jimbojsb
 
Geek Austin PHP Class - Session 3
Geek Austin PHP Class - Session 3Geek Austin PHP Class - Session 3
Geek Austin PHP Class - Session 3jimbojsb
 
Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4jimbojsb
 
Security in php
Security in phpSecurity in php
Security in php
Jalpesh Vasa
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
jimbojsb
 
Php ssession - cookies -introduction
Php ssession - cookies -introductionPhp ssession - cookies -introduction
Php ssession - cookies -introduction
Programmer Blog
 
Session php
Session phpSession php
Session php
200Hussain
 

Viewers also liked (12)

Fall 2011 PHP Class - Session 2
Fall 2011 PHP Class - Session 2Fall 2011 PHP Class - Session 2
Fall 2011 PHP Class - Session 2
 
GeekAustin PHP Class - Session 6
GeekAustin PHP Class - Session 6GeekAustin PHP Class - Session 6
GeekAustin PHP Class - Session 6
 
Geek Austin PHP Class - Session 1
Geek Austin PHP Class - Session 1Geek Austin PHP Class - Session 1
Geek Austin PHP Class - Session 1
 
Austin NoSQL 2011-07-06
Austin NoSQL 2011-07-06Austin NoSQL 2011-07-06
Austin NoSQL 2011-07-06
 
Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1
 
Geek Austin PHP Class - Session 2
Geek Austin PHP Class - Session 2Geek Austin PHP Class - Session 2
Geek Austin PHP Class - Session 2
 
Geek Austin PHP Class - Session 3
Geek Austin PHP Class - Session 3Geek Austin PHP Class - Session 3
Geek Austin PHP Class - Session 3
 
Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4
 
Security in php
Security in phpSecurity in php
Security in php
 
Scaling php applications with redis
Scaling php applications with redisScaling php applications with redis
Scaling php applications with redis
 
Php ssession - cookies -introduction
Php ssession - cookies -introductionPhp ssession - cookies -introduction
Php ssession - cookies -introduction
 
Session php
Session phpSession php
Session php
 

Similar to GeekAustin PHP Class - Session 7

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
Sandeep Pandey
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
vivek shah
 
OOAD notes.pptx
OOAD notes.pptxOOAD notes.pptx
OOAD notes.pptx
RAJESH S
 
OOAD.pptx
OOAD.pptxOOAD.pptx
OOAD.pptx
RAJESH S
 
LN 1 Object Oriented Analysis Design notes.pptx
LN 1 Object Oriented Analysis Design notes.pptxLN 1 Object Oriented Analysis Design notes.pptx
LN 1 Object Oriented Analysis Design notes.pptx
rajesshs31r
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
ethiouniverse
 
Object oriented programming
Object oriented programmingObject oriented programming
Questpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPSQuestpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPS
gdrealspace
 
For-oop.pdf
For-oop.pdfFor-oop.pdf
For-oop.pdf
MBRoman1
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
Sujit Kumar
 
Chapter08 - Inheritance.ppt
Chapter08 - Inheritance.pptChapter08 - Inheritance.ppt
Chapter08 - Inheritance.ppt
Patrick Okot
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
ssusere9cd04
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
Java(inheritance)
Java(inheritance)Java(inheritance)
Java(inheritance)
Pooja Bhojwani
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptx
Ayan974999
 
Pj01 x-classes and objects
Pj01 x-classes and objectsPj01 x-classes and objects
Pj01 x-classes and objects
SasidharaRaoMarrapu
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 

Similar to GeekAustin PHP Class - Session 7 (20)

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
 
Core java lessons
Core java lessonsCore java lessons
Core java lessons
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
 
OOAD notes.pptx
OOAD notes.pptxOOAD notes.pptx
OOAD notes.pptx
 
OOAD.pptx
OOAD.pptxOOAD.pptx
OOAD.pptx
 
LN 1 Object Oriented Analysis Design notes.pptx
LN 1 Object Oriented Analysis Design notes.pptxLN 1 Object Oriented Analysis Design notes.pptx
LN 1 Object Oriented Analysis Design notes.pptx
 
Object Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptxObject Oriented Programming Tutorial.pptx
Object Oriented Programming Tutorial.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Questpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPSQuestpond - Top 10 Interview Questions and Answers on OOPS
Questpond - Top 10 Interview Questions and Answers on OOPS
 
For-oop.pdf
For-oop.pdfFor-oop.pdf
For-oop.pdf
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
 
Chapter08 - Inheritance.ppt
Chapter08 - Inheritance.pptChapter08 - Inheritance.ppt
Chapter08 - Inheritance.ppt
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
Java(inheritance)
Java(inheritance)Java(inheritance)
Java(inheritance)
 
Ayan Das_25300121057.pptx
Ayan Das_25300121057.pptxAyan Das_25300121057.pptx
Ayan Das_25300121057.pptx
 
Pj01 x-classes and objects
Pj01 x-classes and objectsPj01 x-classes and objects
Pj01 x-classes and objects
 
Chapter2 bag2
Chapter2 bag2Chapter2 bag2
Chapter2 bag2
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 

GeekAustin PHP Class - Session 7

  • 1. Beginning PHP Session #7 January 12, 2011 Josh Butts
  • 2. Agenda • More OOP • Database Object • Update Vanity with Objects
  • 3. Inheritance • Objects can inherit behavior and default state from other objects • A class that inherits from another class is called a sublcass • When we subclass something, we “extend” it • Subclasses may add or change functionality
  • 4. PHP’s Single Inheritance • A class may have only one parent class • Any given class can have many subclasses
  • 5. Single Inheritance Person Student Honors Exchange Student Student
  • 6. Visibility • Public - anyone can call a method or modify a property • Protected - only this class or subclasses may call the method or modify the property • Private - only this class may modify or call
  • 7. Why use non-public? • Getters & Setters can inject behavior • Protects unrelated code from changing your state

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n