Glossary header

BASE CLASS

A base class is a class that other classes use to inherit properies and behaviors. Using a base class allows us to reuse code through the process of inheritance. Our characters have the base class PLAYER, and are also base class of the characters ELF, WIZARD, ORK and KNIGHT after we upgrade


BEHAVIOR

Behaviors, or methods, determine what type of functionality a class has. With behaviors, we can determine how an object will act in our game. We created an attack behavior for our character that takes in a specific weapon.


CLASS

A class in OOP is a template that describes one or more objects. It serves as a template for creating, or instantiating, specific objects within a program. We created character classes to be the template for the character objects with varing types of properties and methods, such as clothes color and attack weapons.


ENCAPSULATION

Encapsulation refers to the grouping of properties and behaviors (or methods). A class encapsulates its data and protects it by hiding values inside the class, preventing unauthorized access to them. We talked about this concept in the knight class, where we prevented a user from making the knight's hair green or dressing him in a tutu.


INHERITANCE

Inheritance is the process that allows us to derive a class from another class, in which the properties and methods of the derived class are available to the new class. We used the base class PLAYER to pass on life and Tolkiens to each of our character classes. Additionally, we created an UPGRADE class to inherit from our character class so that we could override the attack behaviors with new and improved weapons.


INSTANTIATE

The process of creating an instance of a class. We instantiated an instance of a character class by seleting properties and a behavior, then clicking create.


OBJECT

An object is a specific instance of a class, containing values declared during the instantiation process. An object can be thought of as a copy of a class. We created character objects ELF, KNIGHT, WIZARD and ORK from their respective character classes. When we created the object, we selected values for properties and behaviors that became a part of our object.


OOP

OOP is a programming style that focues on objects that contain data in the form of properties and behaviors. OOP allows us to reuse and modify code with inheritance, polymorphism and encapsulation.


OVERLOAD

Overloading refers to the ability to use a single method to define multiple behaviors of a class. Overloaded behaviors are generally used when they execute the same task but with a slightly different outcome. We overloaded the Elf's attack behavior to accomodate many types of weapons.


OVERRIDE

Overriding allows subclasses to replace behaviors that are already defined in a base class with specific implementation for the subclass. When we upgraded our character, we replaced the weapon for attack by overriding the base class weapon.


POLYMORPHISM

Polymorphism refers to a programming languages ability to process objects differently based on their data type or class. All of our player characters have an attack behavior. We can simply say "elf, attack!" and based on the weapon that elf instance has, the elf will attack. In our game, when we push the attack button, the game says "character, attack." Polymorphism makes it possible for this behavior to work no matter what character we have selected as our player.


PROPERTY

A property is a data value of a class that an object will have. We created characters with properties such as skin color, hair color and clothes color. These property values will be passed to an object during the instatntiation process.


SUBCLASS

A subclass is a class created specifically to inherit properties and behaviors from a base class. We used subclasses to upgrade our character's attack data without having to rewrite the character class with inheritance.