defination for object oriented programming,concept for oops,defination for class,object,member variable,member function,inheritance,parentclass and child class defination,polymorphism,overloading,dataabstraction,encapsulation,constructor and destructor,interfaces and rules,abstract class,object cloning
2. PAPER NAME : PROGRAMMING IN PHP
STAFF NAME : MS.V.SHANTHI M.SC,M.PHIL,M,TECH,PGDCA.
CLASS : III BCA
SEMESTER : VI
3. Object oriented programming
PHP is a server side scripting language,
mainly used for web development but also
used as a general proposition
programming language. Object Oriented
Programming, is a type of
programming language principle added to php
, that helps in building complex, reusable web
applications.
4. OBJECT ORIENTED CONCEPTS
• Class
• Object
• Member Variable
• Member Function
• Inheritance
• Parent Class
• Child Class
• Polymorphism
• Data Abstraction
• Encapsulation
• Constructor
• Destructor
5. Class:
This is a programmer defined data type which
inject local functions as well as local data. You
can think of a class as a template for making
many specimen of the same kind of object.
6. Object:
An single instance of the data structure
defined by a class. You define a class once and
then make many objects that befit to it.
Objects are also known as specimen.
7. Member Variable:
These are the variables defined inside a class.
This data will be insensible to the outside of
the class and can be accessed via member
functions. These variables are called virtue of
the object once an object is created.
8. Member function :
These are the function clear inside a class and
are used to admission object data.
Inheritance:
When a class is defined by inheriting current
function of a parent class then it is called
inheritance. Here child class will receive all or
few member functions and variables of a
parent class.
9. Parent class:
A class that is inborn from by another class.
This is also called a base class or super class.
Child class:
A class that receives from another class. This
is also called a subclass or derived class.
10. Polymorphism:
This is an object oriented idea where same
function can be used for dissimilar purposes.
For example function name will remain same
but it take different number of clash and can
do different task.
Overloading:
A type of polymorphism in which some or all
of operators have different implementations
build upon on the types of their arguments.
Build upon functions can also be overloaded
with different implementation.
11. Data Abstraction:
Any representation of data in which the
implementation details are occult.
Encapsulation:
Refers to a idea where we encapsulate all the
data and member functions constant to form
an object.
12. Constructor:
Refers to a exceptional type of function which
will be called spontaneously whenever there is
an object formation from a class.
Destructor:
Refers to a exceptional type of function which
will be called spontaneously whenever an
object is deleted or goes out of scope.
13. PHP: Inheritance
• Inheritance is a well-established programming
principle.
• Inheritance allows classes to form a hierarchy
like a family tree.
• Allows subclasses to share the techniques and
belongings (which are public or protected) of
its superclass.
• Superclass is the parent class.
• A subclass can add properties and methods.
• Inheritance allows reusing code.
15. INTERFACES:
An interface is a explanation of the actions
that an entity can do.
Interface is written in the similar way as
the class the statement with interface
keyword.
16. Rules of Interfaces:
• All methods professed in an interface must be
public; this is the nature of an interface.
• All methods in the interface must be applied
within a class; failure to do so will result in a
fatal error.
• The class applying the interface must use the
exact same technique signatures as are defined
in the interface
• Interfaces can be prolonged like classes using
the spreads operator.
17. Abstract Classes:
An abstract class is a class that contains at
least one abstract technique. The abstract
technique is function declaration without
anybody and it has the only name of the
technique and its parameters.
There can be any number of techniques in the
class and we have to announce the class as
abstract only when there is an abstract method
18. PHP: Interfaces
• Provides methods to implement.
• Derived classes may implement more than one
interface.
• Interfaces may succeed to from other
interfaces using the extends keyword.
• All techniques are supposed to be public in the
interface definition can be defined explicitly as
public or implicitly.
• When a class equipment multiple interfaces
there cannot be any naming collision between
methods defined in the different interfaces.
19. PHP: Object Cloning
• Cloning is used to produce a copy of an object.
• An entity copy is produced by using
the clone keyword.
• When an entity is cloned, PHP 5 will perform
a shallow copy of all of the object's properties.
• PHP affords a special method __clone to copy
an object.
• Once the cloning is complete, if a __clone()
method is defined, then the newly created
object's __clone() method will be called, to
allow any necessary properties that need to be
changed.