Sunday, July 16, 2006

Some concept in C/C++

A class defines a data type,

"object" usually means "an instance of a class." Thus a class defines the behavior of possibly many objects
A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change.
The class to which an object belongs is also (usually) static. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belong to that class right up until the time that it is destroyed.
An Object on the other hand has a limited lifespan. Objects are created and eventually destroyed. Also during that lifetime, the attributes of the object may undergo significant change.


the difference between the keywords struct and class

The members and base classes of a struct are public by default, while in class, they default to private. Note: you should make your base classes explicitly public, private, or protected, rather than relying on the defaults. C structs don't support encapsulation. struct and class are otherwise functionally equivalent.

No comments:

Post a Comment