Object Oriented Programming (Theory)

Submitted by: 

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.


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.