Archive for the ‘Classes and objects’ Category

Size of an empty class

In brief: 

The size of an empty class is non zero, the reason for this is, if size of empty class is zero, it violates C++ object definition, the object definition says that "object should have unique identity, state, behavior". How can an empty class object make sure of unique identity if the size of object [...]

Continue Reading..
Posted in Classes and objects

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.
struct and class are otherwise functionally equivalent.
OK, enough of that squeaky clean techno talk. Emotionally, most developers make a [...]

Continue Reading..
Posted in Uncategorized