• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# inheritence?

## Recommended Posts

how do i use it? for my base object, every pickup/player/gun/bullet has the same class, Object. but then things like player need more variables, so if i understand inheritance correctly, i can still make player an object, but add variables somehow. is this inheriatnce? and hwo do i do it.

##### Share on other sites
Well, how inheritance works is that you create a base class, and then for every type of object you create. You would create another class, but state that it is deriving from the first class, for example, lets say that you have a base class foo, and you want to create a class that takes all of the attributes of base class, but would add other features as well.
class foo{    blah;    blah;    blah;};class bar: public foo{   //more stuff goes here};

##### Share on other sites
OOOOOH thats what that is. i''ve been looking at a lot of tutorials, and i could never figure out what that was. thx

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627638
• Total Posts
2978343

• 10
• 12
• 22
• 13
• 33