Inverse of a number else raise exception

Program to find the inverse of a number else if its not a number then
raise an exception.
Program to raise an exception in main

e.backtrace.inspect : e is an object of Exception class. Prints the
exception location and the file name.
Program to raise an exception for File handling

Program to raise an exception for File handling operations. This
program copies the content of one file to another and then diplays on
the terminal. Exception is raised if an error occours.
Program to understand the accessibility of methods

Public methods are accessible. A NomethodError gets generated while
accessing the protected and private methods of the class.
Program to compare the instance variables.

compare method compares the instance varible age of the object on which
the method is called to the object passed as parameter.
Program for accessor methods
Prgram for instance variable inheritance

Instance variable of the base class is inherited by the derived class.
Setter method/getter method

Program for attr accessor methods. Defining your own setter method
Freeze method of String class

Program to initialize a string variable. Call the freeze method on the
variable. After calling the freeze method, no changes can be made to the
varible.
Dumping object attributes into a file

Including a game file. Creating an object of the Game class. Dumping the
object into another file.
Unmarshalling.

Include the Game classfile. Load the game dump file and store the
unmarshalled contents into the instance variable and display the
contents.
Constant can be declared only once

A constant can be declared only once. If we try to declare it twice we
get the following error:
p054constwarn.rb:3: warning: already initialized constant A_CONST
p054constwarn.rb:2: warning: previous definition of A_CONST was here
Altering a string referenced by a constant

The string referenced by a constant can be altered.
Constants in a class and outside a class

Accessing constants outside the class. We access the constant using
'::'. eg: puts ::CONST
Learning about variables in OOPS

Program for displaying values of global, instance variables, class variables
and constants
Methods in a module

Defining methods in module with Module.methodname
Polymorphism example

Program to illustrate polymorphism example. Class Dog and Cat inherit
from Animal class and have talk method. The talk method has more than
one form.
Baby Dragon program

Baby Dragon is a virtual pet who is able to eat, sleep and poop, which
meand we will need to be able to feed it, put it to bed and take it on
walks. Internally our dragon will need to keep a track of wheather it is
hungry.