OOP consists of programming languages that manipulate Objects. They tend to use data more than logic.

What are some advantages of OOP?

  • Code is really easy to reuse. We use lots of Classes, Objects and Methods/Functions that can be called throughout your program.
  • Encapsulation, which stops commands leaking outside of functions. Keeps everything in scope. You can keep all your data, functions .etc inside of a single object.
  • It’s often easier to design.
  • Easier to maintain, scale and debug!

What sucks about OOP?

  • A little complicated to learn if you’ve never done it before, or you’re from a procedural/linear programming background..
  • Requires a little extra thinking and sometimes planning
  • You need to write more code usually. However, when scaled, you’ll because to call methods that you’ve already written!

How do you change visibility in OOP?

You can usually change the visibility of your variables and methods by prefixing them with either:

  • Public; everyone can use
  • Private; only things in the same class or object can use
  • Protected; only things in the same class and/or extended classes can use

How do you instantiate a Class in PHP OOP?

You create a new variable,  then you make it equal to a new Class. This is now an Object.

//Our theoretical class Boss.
$josh = new Boss;

//We can call variables from the object Josh...
echo $josh->bankBalance;

//We can also run methods...
echo $josh->buy('Lambergeeneh');


Leave a Reply
You May Also Like

Java Queue: How to Make a Queue (ADT) in Java

Java comes with some different datatypes you can use from the start.…

OnePress Social Locker, WordPress Plugin Review

Social media lockers have always been lucrative. If you’re running any sort…

SEOClerks Review: The Best Place to Buy Cheap Social Media Services

SEO is a game where winning can make you millions and losing…

4 Ways To Make Money with Your Old Computer or Laptop

Many of us have been through a few computers on our journey…