classes?

Jan 20, 2015 at 3:33pm
I'm not sure I completely understand the concept of classes. They are like structs with functions that can be used in that class but why put functions in each class? why not put them outside so that they can be used by everything. what I'm asking is what is gained by putting functions in classes?
Jan 20, 2015 at 3:56pm
Because an airplane class might have a function called 'Fly()', and an Animal class might have a function called 'Defecate()'. now why would you ever want to do this:

1
2
Airplane myAirplane;
myAirplane.Defecate();

? You wouldn't. It makes no sense.

it minimises the scope of everything make things a lot easier to debug.

http://en.wikipedia.org/wiki/Object-oriented_programming
http://www.cplusplus.com/doc/tutorial/classes/
Last edited on Jan 20, 2015 at 3:58pm
Topic archived. No new replies allowed.