Hi All,
Anyone give me a detailed description about CLASS. Till now i didn't used class in my projects. What r its advantages. Pls explain how can i apply it.
Thanks in Advance
Printable View
Hi All,
Anyone give me a detailed description about CLASS. Till now i didn't used class in my projects. What r its advantages. Pls explain how can i apply it.
Thanks in Advance
OK, so because you are in the game forum, I will take it that way. Think of a game, a space shooter game. You will have a lot of enemies. They look a bit different from each other, but they have a lot of things in common. So you can use a class to store all the variables and methods for a space ship in a class. Variables can be X, Y coordinates, or speed, or anything you need to store about a spaceship. Methods can be to shoot or move in a special way or anything you need.
Now you can make instances of that class. All your instances has the same variables and methods, but you can give the variables and methods different data, so all the space ships look/act different.
Classes is just to simplify things, and can save you a great deal of work...