C++ Classes & Objects

C++ CLASSES & OBJECTS A class is a mechanism for creating user-defined data types. It is similar to the C language structure data type. In C, a structure is composed of a set of data members. In C++, a class type is like a C structure, except that a class is composed of a set […]

C++ CONSTRUCTORS

C++ Constructors We often want to initialize some or all the member variables for an object when you declare the object. C++ includes special provisions for such initializations. When we define a class, we can define a special kind of member function known as Constructors. A Constructor is a member function that is automatically called […]

C++ DESTRUCTORS

C++ Destructors Similarly to a constructor, A Destructor is a special kind of member function that is automatically called when an object about to destroy. Destructors are usually used to deallocate memory and do another cleanup for a class object and its class members when the object is destroyed. A destructor is called for a […]

C++ Friend Function & Classes

C++ Friend Function & Classes C++ Friend Function & Classes One of the most important concepts of object-oriented programming is data hiding, i.e., a nonmember function cannot access the class object’s related private or protected data. But, sometimes this restriction may force the programmer to write long and complex codes. So, there is a mechanism […]

C++ Introduction

C++ Introduction During the 60s, while computers were still in an early stage of development, many new programming languages appeared. Among them, ALGOL 60, was developed as an alternative to FORTRAN but taking from it some concepts of structured programming which would later inspire most procedural languages, such as CPL and its successors (like C++). […]

inheritance in c++ with example program

What is Inheritance? The basic philosophy behind Object Orientation is to represent things as they exist in the real world. For example, unlike procedural programming languages. C++ treats everything as an object. Like objects exist in the real world, objects in C++ contain properties i.e. members and behavioral attributes i.e. methods. Similarly, another concept has […]