Oct 11, 2013

vJASS for mules #5: Introduction to OOP

OOP (Object-Oriented Programming) is a model of programming where you represent data in shape of objects. Each object has its own actions and attributes. Example:


Object: Dog
Actions: Bark, eat, defecate (urgh!)...
Attributes: Skin color, height, weight...

You see? It's simple! But how we represent that scheme in a programming language?

Actions are the methods. Methods are like functions, but with the difference that they own to their objects and can only be accessible through them. If we want to call a determined method, we use the syntax:

call object_name.method_name()

We'll talk more about it later.

Now, attributes. They follow the same principle of methods: They're like variables, but with the difference that they own to their objects and can only by accessible through them. You got the point.

In the next lesson, we'll learn about structs(classes), the heart of OOP.


Answer mentally:

  • What is OOP?
  • What is an object?
  • What is a method?
  • What is an attribute?
  • Give a example of a real world object, its methods and attributes

<<Previous>>                                                                                  <<Next>>

No comments :

Post a Comment