This week, we were taught the object oriented concepts. Object-oriented programming is a style of coding that allows developers to group similar tasks into classes. This helps keep code following the tenet “don’t repeat yourself” and easy-to-maintain.
First we were told about the benefits of the DRY Programming. Then we understood the basic concepts of objects and classes.
We learned about the syntax of class.
After creating the class, a new class can be instantiated and stored in a variable using the new keyword:
$obj = new MyClass;
Methods are class-specific functions.
Also learned about public,private and protected properties of the classes.