Classes

To make programming easier, our teacher introduced us to classes. When you ask wiki : "In object-oriented programming, a class is a construct that is used to create instances of itself – referred to as class instancesclass objectsinstance objects or simplyobjects. A class defines constituent members which enable its instances to have state and behavior.[1] Data field members (member variables or instance variables) enable a class instance to maintain state. Other kinds of members, especially methods, enable the behavior of class instances. Classes define the type of their instances."


Just imagine we have a class called Dog.  A dog have variables like tail, nose, gender, and age. Methods like things that the dog can do like eat, pee, sleep, bark, etc. 


With classes, programming becomes easier because you can practically any class you have made before in any program as long as the situation applies. 


In our programming class, I was asked to create a mini-calculator that will basically add, subtract, multiply or divide 2 numbers using classes. Basically the 2 variables are the 2 inputed numbers while the 4 methods are the 4 different operations. I was able to pull it off. I will post the mini-program i made using php in my next post.