WT Experiment8
WT Experiment8
Aim : To make student understand the basic OOP concepts using PHP
and usage of the same
Member Variable − These are the variables defined inside a class. This
data will be invisible to the outside of the class and can be accessed via
member functions. These variables are called attribute of the object once an
object is created.
Member function − These are the function defined inside a class and are
used to access object data.
Abstraction - Abstraction in object-oriented programming (OOP)
refers to the concept of hiding the complex implementation details of
an object and exposing only the essential features or functionalities
Encapsulation – In encapsulation the internal details are hidden
from external code, and access is controlled through these public
methods, providing a level of abstraction
Inheretance - Inheritance is a concept where a new class (called the
child or subclass) can inherit attributes and behaviors (properties and
methods) from an existing class (called the parent or superclass). This
allows you to create a relationship between classes.
Constructor – It is a special type of member function which will be called
automatically whenever there is an object formation from a class.
Destructor − It is a special type of member function which will be called
automatically whenever an object is deleted or goes out of scope.
$myCar->drive();
Conclusion:-
Thus, we have studied, understood and practically checked OOP concepts in php.