Polymorphism Feature in C++

Polymorphism Feature in C++ Polymorphism means single name but multiple formats and this is one of the crucial features of C++. Furthermore, when there are multiple formats of a single function then choosing an appropriate version of the function is a problem. Choosing appropriate version of the function at the compile time is referred as … Read more Polymorphism Feature in C++

Inheritance in C++

Inheritance in C++Inheritance is a very important feature of object-oriented programming approach. Further, which provides the mechanism of reusability of classes. Moreover, it is very important to reuse classes which are tested. And this idea also saves resources and increases the reliability of the software. Basically, there are three types( Hybrid and Hierarchical are also … Read more Inheritance in C++

Sum of Natural Numbers in C++

Sum of Natural Numbers in C++ Program Description- In this program, a class Sum is declared. Which has two public variables n and i and a public function sum_of_n() which takes an integer argument( user should provide a natural number) and returns sum of natural numbers. Moreover, in main() function an object s1 of type … Read more Sum of Natural Numbers in C++

Factorial in CPP Using Class

Factorial in CPP Using Class Program Description- Program that calculates factorial in cpp of a natural number. Further, a class Fact is declared in which there are two public integer  variables  which are n and i and a public function factorial() which takes integer variable as an argument and  and returns an integer. Furthermore, in … Read more Factorial in CPP Using Class