SlideShare a Scribd company logo
Web Design
and
Development
By: Shahrzad Peyman
Session 9
December-2017
shahrzad.peymaan@gmail.com
1
2
Today’s Presentation
• self
• Inheritance
• Access Level
• Interface
• Abstract
• Trait
Constructor
3
When creating a new object, you can pass a list
of arguments to the class being called. These are
passed to a special method within the class,
called the constructor, which initializes various
properties.
Static Method
4
You can also define a method as static, which
means that it is called on a class, not on an
object. A static method has no access to any
object properties and is created and accessed as
in below example:
Declaring Constants
5
You can define constants inside classes. The
generally accepted practice is to use uppercase
letters to make them stand out.
Encapsulation
6
In basic terms, it’s the way we define the visibility of
our properties and methods.
• When you’re creating classes, you have to ask
yourself what properties and methods can be
accessed outside of the class.
Access Level
7
Specifier Class SubClass all
Private *
Protected * *
Public * * *
Inheritance
• In object-oriented programming, inheritance
is when a class is based on another class,
using the same implementation or specifying
a new implementation to maintain the same
behavior.
• Such an inherited class is called a subclass
of its parent class or super class.
8
Inheritance
9
Inheritance
10
11
Interface
An interface is an outline of what a particular
object can do. You will often hear that an
interface is a contract. This is true in as much
as an interface defines the public methods that
a class must implement.
Object interfaces allow you to create code
which specifies which methods a class must
implement, without having to define how these
methods are handled.
Interface
12
Abstract
13
An abstract class is a special type of class that can't
be instantiated — in other words, you can't create
objects from it. Instead, you create child classes
from the abstract class, and create objects from
those child classes instead.
An abstract class is designed to be used as a
template for creating classes.
An abstract class will have abstract methods which
are defined by the abstract keyword, these methods
are like the methods defined in the interface classes.
14
Abstract
Interface vs Abstract
Interface Abstract
The Code
• abstract methods
• constants
• abstract methods
• constants
• concrete methods
• concrete variables
Access Modifiers • public
• public
• private
• protected
Number of Parents
Class can impelement
more than one interface
Class can inherit only
from one abstract class
15
Trait
16
One of the problems of PHP as a programming
language is the fact that you can only have
single inheritance. This means a class can only
inherit from one other class.
However, a lot of the time it would be beneficial
to inherit from multiple classes. For example, it
might be desirable to inherit methods from a
couple of different classes in order to prevent
code duplication.
17
Trait
A Trait is simply a group of methods that you
want include within another class.
Ad

More Related Content

What's hot (20)

Javascript Roadmap - The Basics
Javascript Roadmap - The BasicsJavascript Roadmap - The Basics
Javascript Roadmap - The Basics
Aswin Barath
 
Php functions
Php functionsPhp functions
Php functions
baabtra.com - No. 1 supplier of quality freshers
 
Tech talk webtech
Tech talk webtechTech talk webtech
Tech talk webtech
Shehrevar Davierwala
 
Object oriented vs. object based programming
Object oriented vs. object based  programmingObject oriented vs. object based  programming
Object oriented vs. object based programming
Mohammad Kamrul Hasan
 
Carlos Amador .Net Portfolio
Carlos Amador .Net PortfolioCarlos Amador .Net Portfolio
Carlos Amador .Net Portfolio
CMA_SlideShare
 
Tech talk php_cms
Tech talk php_cmsTech talk php_cms
Tech talk php_cms
Shehrevar Davierwala
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
CSS: selectors and the box model
CSS: selectors and the box modelCSS: selectors and the box model
CSS: selectors and the box model
Idan Gazit
 
CSS3 and Selectors
CSS3 and SelectorsCSS3 and Selectors
CSS3 and Selectors
Rachel Andrew
 
Web Front End
Web Front EndWeb Front End
Web Front End
Mohamed Essam
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
baabtra.com - No. 1 supplier of quality freshers
 
Object-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modulesObject-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modules
Durgesh Singh
 
70 536
70 53670 536
70 536
Sankar Balasubramanian
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
Thitipong Jampajeen
 
25 php interview questions – codementor
25 php interview questions – codementor25 php interview questions – codementor
25 php interview questions – codementor
Arc & Codementor
 
Oops
OopsOops
Oops
Prabhu R
 
Coding conventions
Coding conventionsCoding conventions
Coding conventions
systemcrashed
 
Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1Object Oriented Programming in Java _lecture 1
Object Oriented Programming in Java _lecture 1
Mahmoud Alfarra
 
DSL in test automation
DSL in test automationDSL in test automation
DSL in test automation
test test
 
PhD Presentation
PhD PresentationPhD Presentation
PhD Presentation
mskayed
 

Similar to Web Design & Development - Session 9 (20)

Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
Sudip Simkhada
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traits
Alena Holligan
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
Michael Heron
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
Muhammad Younis
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
Adikhan27
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
husnainali397602
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
UMAR ALI
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Vasilios Kuznos
 
The View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptThe View object orientated programming in Lotuscript
The View object orientated programming in Lotuscript
Bill Buchan
 
Software enginnnering introduction (2).pptx
Software enginnnering introduction (2).pptxSoftware enginnnering introduction (2).pptx
Software enginnnering introduction (2).pptx
parmidakhrz02
 
chapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingchapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programming
WondimuBantihun1
 
7494611
74946117494611
7494611
Luis Daniel Abelaira Huertos
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
Questpond
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
Hari kiran G
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
Army Public School and College -Faisal
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
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
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Jscript part2
Jscript part2Jscript part2
Jscript part2
Girish Srivastava
 
Unusual C# - OOP
Unusual C# - OOPUnusual C# - OOP
Unusual C# - OOP
Medhat Dawoud
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traits
Alena Holligan
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
Michael Heron
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
Muhammad Younis
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
Adikhan27
 
JS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptxJS Design patterns in Web technologies including oop techniques.pptx
JS Design patterns in Web technologies including oop techniques.pptx
husnainali397602
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
UMAR ALI
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Vasilios Kuznos
 
The View object orientated programming in Lotuscript
The View object orientated programming in LotuscriptThe View object orientated programming in Lotuscript
The View object orientated programming in Lotuscript
Bill Buchan
 
Software enginnnering introduction (2).pptx
Software enginnnering introduction (2).pptxSoftware enginnnering introduction (2).pptx
Software enginnnering introduction (2).pptx
parmidakhrz02
 
chapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programmingchapter 5 concepts of object oriented programming
chapter 5 concepts of object oriented programming
WondimuBantihun1
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
Questpond
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
Hari kiran G
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
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
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Ad

More from Shahrzad Peyman (9)

Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6
Shahrzad Peyman
 
Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
Shahrzad Peyman
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3
Shahrzad Peyman
 
Web Design & Development - Session 2
Web Design & Development - Session 2Web Design & Development - Session 2
Web Design & Development - Session 2
Shahrzad Peyman
 
Web Design & Development - Session 1
Web Design & Development - Session 1Web Design & Development - Session 1
Web Design & Development - Session 1
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2
Shahrzad Peyman
 
Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6
Shahrzad Peyman
 
Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
Shahrzad Peyman
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3
Shahrzad Peyman
 
Web Design & Development - Session 2
Web Design & Development - Session 2Web Design & Development - Session 2
Web Design & Development - Session 2
Shahrzad Peyman
 
Web Design & Development - Session 1
Web Design & Development - Session 1Web Design & Development - Session 1
Web Design & Development - Session 1
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2
Shahrzad Peyman
 
Ad

Recently uploaded (20)

Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software EngineerAlbert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy
 
Hyper Casual Game Developers Company
Hyper  Casual  Game  Developers  CompanyHyper  Casual  Game  Developers  Company
Hyper Casual Game Developers Company
Nova Carter
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Call of Duty: Warzone for Windows With Crack Free Download 2025
Call of Duty: Warzone for Windows With Crack Free Download 2025Call of Duty: Warzone for Windows With Crack Free Download 2025
Call of Duty: Warzone for Windows With Crack Free Download 2025
Iobit Uninstaller Pro Crack
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
iTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation KeyiTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation Key
raheemk1122g
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Let's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured ContainersLet's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured Containers
Gene Gotimer
 
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t IgnoreWhy CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Shubham Joshi
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
SamFw Tool v4.9 Samsung Frp Tool Free Download
SamFw Tool v4.9 Samsung Frp Tool Free DownloadSamFw Tool v4.9 Samsung Frp Tool Free Download
SamFw Tool v4.9 Samsung Frp Tool Free Download
Iobit Uninstaller Pro Crack
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
UI/UX Design & Development and Servicess
UI/UX Design & Development and ServicessUI/UX Design & Development and Servicess
UI/UX Design & Development and Servicess
marketing810348
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
File Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full VersionFile Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full Version
raheemk1122g
 
Best HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRMBest HR and Payroll Software in Bangladesh - accordHRM
Best HR and Payroll Software in Bangladesh - accordHRM
accordHRM
 
wAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptxwAIred_LearnWithOutAI_JCON_14052025.pptx
wAIred_LearnWithOutAI_JCON_14052025.pptx
SimonedeGijt
 
Unit Two - Java Architecture and OOPS
Unit Two  -   Java Architecture and OOPSUnit Two  -   Java Architecture and OOPS
Unit Two - Java Architecture and OOPS
Nabin Dhakal
 
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software EngineerAlbert Pintoy - A Distinguished Software Engineer
Albert Pintoy - A Distinguished Software Engineer
Albert Pintoy
 
Hyper Casual Game Developers Company
Hyper  Casual  Game  Developers  CompanyHyper  Casual  Game  Developers  Company
Hyper Casual Game Developers Company
Nova Carter
 
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.pptPassive House Canada Conference 2025 Presentation [Final]_v4.ppt
Passive House Canada Conference 2025 Presentation [Final]_v4.ppt
IES VE
 
Call of Duty: Warzone for Windows With Crack Free Download 2025
Call of Duty: Warzone for Windows With Crack Free Download 2025Call of Duty: Warzone for Windows With Crack Free Download 2025
Call of Duty: Warzone for Windows With Crack Free Download 2025
Iobit Uninstaller Pro Crack
 
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-RuntimeReinventing Microservices Efficiency and Innovation with Single-Runtime
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Natan Silnitsky
 
GC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance EngineeringGC Tuning: A Masterpiece in Performance Engineering
GC Tuning: A Masterpiece in Performance Engineering
Tier1 app
 
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by AjathMobile Application Developer Dubai | Custom App Solutions by Ajath
Mobile Application Developer Dubai | Custom App Solutions by Ajath
Ajath Infotech Technologies LLC
 
iTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation KeyiTop VPN With Crack Lifetime Activation Key
iTop VPN With Crack Lifetime Activation Key
raheemk1122g
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Let's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured ContainersLet's Do Bad Things to Unsecured Containers
Let's Do Bad Things to Unsecured Containers
Gene Gotimer
 
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t IgnoreWhy CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Why CoTester Is the AI Testing Tool QA Teams Can’t Ignore
Shubham Joshi
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
How I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetryHow I solved production issues with OpenTelemetry
How I solved production issues with OpenTelemetry
Cees Bos
 
UI/UX Design & Development and Servicess
UI/UX Design & Development and ServicessUI/UX Design & Development and Servicess
UI/UX Design & Development and Servicess
marketing810348
 
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business StageA Comprehensive Guide to CRM Software Benefits for Every Business Stage
A Comprehensive Guide to CRM Software Benefits for Every Business Stage
SynapseIndia
 
File Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full VersionFile Viewer Plus 7.5.5.49 Crack Full Version
File Viewer Plus 7.5.5.49 Crack Full Version
raheemk1122g
 

Web Design & Development - Session 9

  • 1. Web Design and Development By: Shahrzad Peyman Session 9 December-2017 shahrzad.peymaan@gmail.com 1
  • 2. 2 Today’s Presentation • self • Inheritance • Access Level • Interface • Abstract • Trait
  • 3. Constructor 3 When creating a new object, you can pass a list of arguments to the class being called. These are passed to a special method within the class, called the constructor, which initializes various properties.
  • 4. Static Method 4 You can also define a method as static, which means that it is called on a class, not on an object. A static method has no access to any object properties and is created and accessed as in below example:
  • 5. Declaring Constants 5 You can define constants inside classes. The generally accepted practice is to use uppercase letters to make them stand out.
  • 6. Encapsulation 6 In basic terms, it’s the way we define the visibility of our properties and methods. • When you’re creating classes, you have to ask yourself what properties and methods can be accessed outside of the class.
  • 7. Access Level 7 Specifier Class SubClass all Private * Protected * * Public * * *
  • 8. Inheritance • In object-oriented programming, inheritance is when a class is based on another class, using the same implementation or specifying a new implementation to maintain the same behavior. • Such an inherited class is called a subclass of its parent class or super class. 8
  • 11. 11 Interface An interface is an outline of what a particular object can do. You will often hear that an interface is a contract. This is true in as much as an interface defines the public methods that a class must implement. Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.
  • 13. Abstract 13 An abstract class is a special type of class that can't be instantiated — in other words, you can't create objects from it. Instead, you create child classes from the abstract class, and create objects from those child classes instead. An abstract class is designed to be used as a template for creating classes. An abstract class will have abstract methods which are defined by the abstract keyword, these methods are like the methods defined in the interface classes.
  • 15. Interface vs Abstract Interface Abstract The Code • abstract methods • constants • abstract methods • constants • concrete methods • concrete variables Access Modifiers • public • public • private • protected Number of Parents Class can impelement more than one interface Class can inherit only from one abstract class 15
  • 16. Trait 16 One of the problems of PHP as a programming language is the fact that you can only have single inheritance. This means a class can only inherit from one other class. However, a lot of the time it would be beneficial to inherit from multiple classes. For example, it might be desirable to inherit methods from a couple of different classes in order to prevent code duplication.
  • 17. 17 Trait A Trait is simply a group of methods that you want include within another class.
  翻译: