Monday , 20 November 2017
Home / Tag Archives: lesson (page 11)

Tag Archives: lesson

Static Methods and Properties – PHP OOP Tutorial

Static Methods and Properties

Let’s learn how to create static methods and properties. Anything that’s static is basically something that can be accessed without needing an instantiation of the class. You also have the advantage of having a value that is consistent through each instance of the class. Let’s take a look at this. Creating Static Properties Inside our Pet Class, add this bit of …

Read More »

Constants – PHP OOP Tutorial

Constants

Constants are variables that don’t change value during the lifetime of a program. Defining constants in classes are a bit different than defining constants outside of a class. Defining Constants In our CanadianPet class, add this bit of code. [crayon-5a123c402e48e592948159/] To define a constant, we use the const keyword. We then follow it by the name of the constant and …

Read More »

Scope Resolution Operator – PHP OOP Tutorial

Scope Resolution Operator

The scope resolution operator may sound intimidating, but it’s actually quite simple to use. What it basically does is it allows you to access static, constant, or overridden methods and properties of a class. We haven’t discussed static and constant properties and methods yet. We will soon in a another tutorial, but for now, we can use it to access …

Read More »

Inheritance – PHP OOP Tutorial

Inheritance

Let’s talk about inheritance. We’ve talked about how to extend a class and covered encapsulation. Inheritance is when a class extends another class and inherits the properties and methods of that class. The main advantage to this is the ability to use a parent class and modify it for a special use without actually modifying the actual class itself. You …

Read More »

Constructor Method – PHP OOP Tutorial

Constructor Method

It’s always good practice to have things set up when someone creates an instance of your class instead of calling a bunch of functions to do so. Users should only have to call set methods when they need to update or change some properties in your class. The constructor method is the perfect solution to setting up your class for …

Read More »

Encapsulation – PHP OOP Tutorial

Encapsulation

Encapsulation may seem like an intimidating topic, but it’s actually quite simple. Object oriented programming is based on 3 principles which are encapsulation, inheritance, and polymorphism. In this tutorial, we’ll be talking about encapsulation and why it’s important to understand this principle. We’ll talk about the other 2 in future tutorials. What is encapsulation? So, what is the meaning behind …

Read More »
ULTIMATE WORDPRESS DEVELOPMENT COURSE
Want to learn how to create your own custom WordPress plugins and themes? Check out my course!
Get 93% off my course. You'll also learn how to integrate WooCommerce and BuddyPress into your projects. This is a limited time offer
Yes, I would like to get 93% off your course!
No Thanks!
close-link