Classes in Ruby

Classes do not have to be in a separate file as you can see from the file below. Let’s look at a class, then break it down. Class Definition As with most languages, you use class to define your class definition, and class names typically start with a capital letter. As with conditions, and other…

The Vector Class

Using arrays to store a collection of variables, even objects, if very beneficial. However, it does have some limitations given that arrays are of a fixed size, and cannot shrink or grow with use. This means you either run out of space after a set of time, or you waste a lot of space as…

Creating an Object

Once you create your class, you need to create an object. The Class is just a blueprint for the program to follow. It doesn’t do anything until you create an object based off of that blueprint. Think of a house. If you have a house blueprint, all you have are some sheets of paper or…