DEV Community

Emmanuel Nyarko
Emmanuel Nyarko

Posted on

Hello devs, Get readyyyyyy let's go through the struggles of OOP together

I want to start with the relationship between an object and its class. I'm breaking it down for the layman who hasn't even touched the keyboard to understand. Consider a class of 50 students. All the students have the same set of attributes of name,age,and height. If I want a student from the class, we call a student out of the class with the 'new' directive to indicate that the student is part of the class and shares the attributes with other members of the class.
Kojo is a student of a physics class. All the students study 8 subjects. If I want to assess Kojo from the physics class, I will call Kojo who's an 'object' to assess his him by his subjects. If you want the values of Kojo's subject, you can call them Kojo's math, Kojo's English, Kojo's science, Kojo's sociology. That's where the object referencing comes into play. Object-> (class variable) or Object.(class variable). So Kojo->math or Kojo.math
Object class relationships seen on the eyes of the general.

OOP #PHP #C

Top comments (0)