The class is the blueprint. Then how do we make an object from it? You use the
new keyword. Think about that. If you wanted to build a house, the architect gives the blueprints to the craftsmen. They will build you a new house. The house is the object, built off the blueprint. Got it?! Do you see how new makes sense?
In this episode, you will create your first object from the blueprint you built in the last episode. You are creating a new user.
New terms that you will learn are:
- Instance – meaning the object, i.e. it’s an instance of the blueprint
- Instantiate – it’s the process of creating the object
You’ll also learn more about PHP Namespacing too, as you see I’m using it not here in this lab, but virtually every lab on Know the Code.
Who needs copy/paste? Right. Writing code from scratch is fun!
Total Lab Runtime: 03:04:55
- 1 Lab Introductionfree 08:27
- 2 What is Object-Oriented Programming (OOP)?free 14:14
- 3 What is an object?free 13:30
- 4 Meet the Class Blueprintpro 04:53
- 5 Creating an Objectpro 07:57
- 6 Defining Characteristicspro 10:54
- 7 Putting the Object to Workpro 13:56
- 8 Hiding Away the Complexitypro 22:40
- 9 Working within the Object with $thispro 15:41
- 10 Internal Control of Object Creationpro 15:07
- 11 Class Constantspro 08:58
- 12 Class Staticpro 17:49
- 13 What OOP is Notpro 19:11
- 14 Practical Examplespro 04:52
- 15 Wrap it Uppro 06:46