[Read more…] about Write a C++ program Illustrates virtual base classes.
Write a C++ program illustrates copy constructor.
Write a C++ program illustrates Abstract class and Pure virtual function.
Write a C++ Program of Virtual Function
Virtual Function in C++
We know that runtime polymorphism is achieved when the objects of different classes in the class hierarchy respond to the same function call each in its way. To invoke same-named functions present both in the base and derived classes using a single interface. But we found that it still could not execute the derived class’s functions and executed the same-named function defined in the base class. Thus it could not achieve polymorphism. To implement polymorphism for invoking the exact version of the same-named member functions in the class hierarchy, we use virtual functions. [Read more…] about Virtual Function in C++
Pointer to C++ classes
Virtual functions play an important role in object oriented programming. Ordinary functions use the concept of early binding. However virtual functions help in late binding. The concept of pointers playa vital role in Virtual functions. [Read more…] about Pointer to C++ classes
Write a C++ program for Container Classes.
Write a C++ Program for Inheritance Beyond Single Level
Write a C++ program for prototype constructors.
What is Destructor in C++
Every object of a class created in a program is stored somewhere in the memory. This memory is automatically deallocated when the object is destroyed. A constructor allocates resources dynamic memory) to an object during its creation in addition to its property of initialization. Similarly, we should have a member function that deallocates the resources (dynamic memory) allocated to an object. Such counterpart (complement) to the constructor is called a Destructor in C++. [Read more…] about What is Destructor in C++
Write a C++ Program for Array of Object.
Write a C++ Program for Memory allocation for a class
The member functions are created and placed in the memory space only once when they are defined as a part of a class specification. Since· all the objects belonging to that class use the same member functions, no separate space is allocated for member functions when the objects are created. For each object, memory is allocated only for member data. Separate memory locations for the objects are essential since the member variables hold different data values for different objects. [Read more…] about Write a C++ Program for Memory allocation for a class
Write a C++ Illustrates multiple objects for a class.
How to Accessing members of a class in C++
Member of a class can be accessed only through the object of a class. The members are accessed as follows: [Read more…] about How to Accessing members of a class in C++
Difference between Structures and Classes in C++
The difference between a structure and a class is that, in a class, the member data or functions are private by default whereas, in a structure, they are public by default. The following segment [Read more…] about Difference between Structures and Classes in C++
Data Storage Type in C++
Auto
The values of the variables are not retained beyond the scope of a function in which they are declared. The values of the variables can be accessed only during the execution of a function. Whatever variables are declared in a function, they are assumed implicitly of auto storage type. For example in the following program segment. [Read more…] about Data Storage Type in C++
Write C++ program is used for finding the real root of an equation by Newton Raphson technique
Write C++ Program Illustrates Passing Structure To A Function.
Array as Argument in A Function in C++
Arguments in a function can also be of array type. When the arrays are passed by value in a function, it is written as shown in the following example: [Read more…] about Array as Argument in A Function in C++
Recursive Function
A recursive function is a function which invokes itself repeatedly. In this case function name appears within the function. Two examples of recursive function are given as follows: [Read more…] about Recursive Function
Functions With or Without Return Value
A function can also return values to the calling program. For such functions, the type of the value returned to the calling function should be mentioned before the function name in the definition. The general syntax of a function which returns value is: [Read more…] about Functions With or Without Return Value
Write a C++ Program of Array of Structures
C++ -> operator
When an element of a structure has to be accessed through pointer, then the → operator is used. It is essential to initialize the pointer before it accesses any structure element. [Read more…] about C++ -> operator
How to Referencing a structure
Structure elements can be referenced by writing the structure variable before the structure element. The structure variable and the structure element are separated by a dot (.) which is called the dot operator. For example [Read more…] about How to Referencing a structure
Write C++ Example to illustrate two dimensional array implemented as pointer to a pointer.
Write C++ Illustrates the use of void pointers.
Write C++ Illustrates array of pointers.
Write C++ Illustrates the use of pointers and & operator
Write C++ program illustrates multiplication of two matrices of order 2 * 3 and 3 * 2 respectively.
Array C++ Binary Search.
This method assumes that the set of elements in a list is first arranged in ascending or descending order. The list is initially divided into two parts and the mid point is found. If the number to be searched is less than the value of the element at the mid point, it implies that the given number lies in the first part of the list, otherwise the given number lies in the second part of the list. This is illustrated as follows: [Read more…] about Array C++ Binary Search.