Loading....
Coupon Accepted Successfully!

 

empty, static, and const Classes

The classes without any data members or member functions are called as empty classes. These types of classes are not frequently used. The empty classes are useful in exception handling. For exception handling, refer the chapter 19 exception handling. The syntax of empty class is as follows:
 

EMPTY CLASSES

class nodata { };

class vacant { };


We can also precede the declaration of classes by the keywords static, const, volatile, etc. But there is no any effect in the class operations. Such declaration can be done as follows:

 

CLASSES AND OTHER KEYWORDS

static class boys { };

const class data { };

volatile class area { };





Test Your Skills Now!
Take a Quiz now
Reviewer Name