Object oriented programming is very simple. You program each class (object) separately, and initialise and call them using methods. This way, you can develop the program in parallel, and minimise debug time.
An example would be making a game. One can program a generic character class, another generic dungeon class, another generic monster class, another making the main class which initialise on all other classes to make the game.
Code-wise, here's an example. This is java, so bear with it for a sec:D
public class Student{
variables
constructor
methods
}
public static void main (String arg[]) throws IOException{
variables
Student lol = new Student(); //instantiate a student object
constructor
methods
}
No comments:
Post a Comment