Classes are user defined datatype
Hi,
You could check out the book "Thinking in C++" by bruce eckel. Its a cool book to learn C++, especially since its free on the net.
int i;
If int were to be a datatype created by the user then you would class it a class.
i is a variable of type int...... similarly variables of a class are called objects
// creating a user defined databype called x
class x
{
char ch; // these are called data members
int i;
public:
x() {
ch = '\0';
i = 0;
}
// functions inside a class are called member functions
};
int main()
{
x ob;
// here x is the class and ob is the object of class x
return 0;
}
Hope it gives you a quick start to your understanding of classes and objects