Hi Richard,
I love object oriented programming, and practically refuse to use any 
language that is not oop. Once you get use to oop you will find out you 
love it.
Let me try and explain this as symply as possible. Perhaps the techno 
talk in class rooms and books threw you where a practical explanation 
will do.
The idea of object oriented programming, (oop,) is the concept you are 
working with values that are related to a specific object like a rope, 
wall, car, gun, etc.. rather than independant variables, and unrelated 
data storage.
Let's think of a simple idea. How about creating a dog. Wouldn't you 
like to have everything related to a dog in it's own area, and functions 
to access it in the same place? Ok, here you go with a class which holds 
all that info, and gives you a new data type called dog.

class Dog {

private:

// private class variables go here.


public:

// public class methods go here to access the variables.
};

Once you actually have the class then you can not only create a dog, but 
name that object like Buddy.

Dog Buddy = new Dog();

Here is the great thing about oop languages. Not only could you create 
Buddy, but this class can be used to create an entire list of dogs, and 
you don't have to asign variables and functions for all the dogs, 
because the class, your data type, holds all that info. So you could 
make several dogs.

Dog Buddy = new Dog();
Dog Princess = new Dog();
Dog Fluffy = new Dog();



Another fantastic thing about oop is inheritence. Being able to share 
data between different classes that are related in some whay. For 
example, in my Monty engine I have a Character class that is used 
genericly for the player, monsters, etc however the monsters and player 
has specific classes for them. Let's look at this.


class Character {

protected:

// common character, monster, and player variables
// go here.

public:

// Common methods for
// other classes go here.
};


class Player: Character {

private:

// Specific player variables go here such as:
// scoring, gold, gems, etc...

public:

// Specific methods to access the
// specific player variables.
};

Once created just doing something like

Player player1 = new Player();

allows me to have access to the player variables, and the character 
variables at the same time. Not only that the new instance of player 
creates the places in memory for the player and character values I need 
to hold the data. Rather than have to create a variable everytime I need 
one one simple constructor or new instance alocates the memory. Calling 
the class destructor whipes all those variables out of memory in one 
single line of code.
Perhaps, you may not completely understand oop and how it works, but I 
think you can understand why programmers like it so much.



to leave send a blank Email to: [EMAIL PROTECTED]
You can contact the list owners/moderators by Emailing [EMAIL PROTECTED]
to go nomail send a blank message to: [EMAIL PROTECTED]
change "nomail" to "normal" to resume messages. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/blindgamers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to