kipmyk / OOP

This repository will be strictly for uploading all my small personal projects associated with OOP-PHP and will be uploading all the small exercises here. The main projects will be uploaded separately into their own repositories.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Personal Testing of Object-oriented programming - OOP

This repository will be strictly for uploading all my small personal projects associated with OOP-PHP and will be uploading all the small exercises here. The main projects will be uploaded separately into their own repositories.

Important of Object-oriented programming over procedural programming:

  1. OOP is faster and easier to execute
  2. OOP provides a clear structure for the programs
  3. OOP helps to keep the PHP code DRY and makes the code easier to maintain, modify and debug
  4. OOP makes it possible to create fully reusable applications with less code and shorter development time

PHP OOP - Classes and Objects

A class is a template for objects, and an object is an instance of class.

A class is defined by using the class keyword, followed by the name of the class and a pair of curly braces ({}).

Note: In a class, variables are called properties and functions are called methods!

PHP Access Modifiers

PHP has three access modifiers: public, private, and protected.

  1. The public access modifier allows you to access properties and methods from both inside and outside of the class. This is default
  2. protected - the property or method can be accessed within the class and by classes derived from that class.
  3. The private access modifier prevents you from accessing properties and methods from the outside of the class.

About

This repository will be strictly for uploading all my small personal projects associated with OOP-PHP and will be uploading all the small exercises here. The main projects will be uploaded separately into their own repositories.


Languages

Language:PHP 98.7%Language:HTML 1.3%