Tuesday, February 12, 2008

Classeses

*fireworks*

Classes seem to be very useful things. The C++ book has enlightened me on their use (and what they are), but not their creation (yet).

A class is a data type, more or less. One example would be 'string.' Used like this:

string words; //defines a string called 'words'

The example class used in the book was 'human' which would be used like this:

human maxHardcastle; //defines a human called maxHardcastle

I would then be a human, as opposed to an integer or string. Classes are much like structures except they can have other function like things inside of them. For instance, string.getline() would be a function inside of the class string. A structure couldn't do that.

Perhaps that makes sense... perhaps it doesn't. I don't know the syntax for classes, but it's probably complicated! =D

No comments: