Members - Reputation: 149
Posted 16 October 2012 - 05:49 PM
So I was just wondering if someone could explain how classes work in C++ and how to use them and the syntax? Basically everything i should know about classes ;p
Members - Reputation: 612
Posted 16 October 2012 - 06:13 PM
Classes and Objects may seem confusing at first, but once you start using them, you'll like what they can do - they are very versatile.
Edited by Shippou, 16 October 2012 - 06:15 PM.
Crossbones+ - Reputation: 4172
Posted 16 October 2012 - 06:15 PM
Take a look at the tutorial in my sig, the coding starts in part 2, and you will see classes in action and with real world examples.
Simplest way to describe it, classes are a way of organizing your code into logical units. A class is a template or model from which objects are created ( a class is a thing, an object is an instance of a thing. For example, my car is a Hyundai Veloster. A Veloster is a class, while MY Veloster is an object ). A class can have both methods ( functions ) and variables. Access to these functions can be public, private or restricted to other classes. You can use one class to create another derived class, and this is called inheritance.
Thats the 1000 foot explanation, now go read the tutorial for actual examples.
EDIT: Added link, as if I change my sig, suddenly this post will make very little sense in the future...
Edited by Serapth, 16 October 2012 - 06:21 PM.
My more Popular Tutorial Series:
GDNet+ - Reputation: 1563
Posted 16 October 2012 - 11:34 PM
OpenChess - 1.0 done!
Classic RPG #1 - Task 9 -> January 1st 2013