Object Oriented Programming (Theory)

Category: 

Introduction:
Welcome! This page will be explaining Object Oriented Programming with examples. The examples are theory only but a code example will be released soon (if not already).

What is Object Oriented Programming?
Object Oriented Programming (OOP) is commonly used in programs which require doing the same things over and over again. Much like a function or method can be ran multiple times, OOP classes can be ran multiple times, simultaneously.

When is OOP used?
OOP is used in games and some other software. The reason it is used in games is because the game requires the same things to happen over and over again at the same time, for example...

Example (Theory):
In games there are entities (characters, animals, keys, doors, etc). Each entity has its own class with it's own variables which is where OOP comes in to play. Say if we had one class which controlled the doors in our map, the objective of the game is to get the specific keys for each door. If we just had one class handling all of our doors, once we got a key it would set the door variable "open" to true and it would open all of the doors in our map. Whereas if we use OOP to control the doors in our map, we still only have one class but all the variables in the class only refer to a single door. Therefore giving us the ability to control seperate doors, with the same amount (or less) of code than that without using OOP.

Finished!


Add new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.

Filtered HTML

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <csharp>, <css>, <java>, <javascript>, <php>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.