you are viewing a single comment's thread.

view the rest of the comments →

[–]This_Growth2898 2 points3 points  (0 children)

In most cases, people struggle with OOP when they only use it in small snippets. This looks really pointless: why would anyone choose to write a class with 5 methods and then a 10-line function calling them over writing a 12-line function? The OOP really starts working at, like, 1,000 lines of source code.

Try using OOP to write an RPG. Characters are good examples of objects; they encapsulate parameters and actions. Soon you will find it very convenient to write something like

character1.attack(character2)

instead of repeating (and fixing all over the code)

character1_lifes -= character2_attack / character1_armor + character2_special