Enum In C++

Enum In C++

Enum in C++ is a data type that holds a fixed collection of constants. It may be used to represent days of the week (SUNDAY, MONDAY, TUESDAY, WEDNESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY) as well as directions (NORTH, SOUTH, EAST,…

Read More
What is Destructor In C++

What is Destructor In C++

A destructor is the complete opposite of a constructor, it destroys class objects. It can only be specified once per class. It is called automatically, just like Constructors. A Constructor is what a destructor is. It has to be named after the class. It is, however, preceded with a tilde symbol (~). Destructors in C++ are not allowed to contain arguments. Modifiers can’t be used on destructors, either. #Note C++ Constructor and Destructor Example: Let’s look at an example of a C++ constructor and destructor that is automatically invoked: Output:

Read More