Operator Overloading in C++

What is operator overloading? Operator overloading is compile time polymorphism. Operator overloading provides a flexible option for the creation of new definitions for most of the C++ operators. We can overload all the C++ operators except the following: Class members access operator (. , .*) Scope resolution operator ( : : ) Size operator(sizeof) Conditional operator ( ? : ) Although the semantics of an operator can be extended, we can’t change its syntax, the grammatical rules that govern its use such as the no of operands precedence and associativity.…

Read More

Polymorphism in C++

What is Polymorphism ? Polymorphism comes from the Greek words “poly” and “morphism”. “poly” means many and “morphism” means form i.e.. many forms. Polymorphism means the ability to take more than one form. Polymorphism allows a single name to be reused for several related but different purposes. The purpose of polymorphism is to allow one name to be used for a general class. Depending on the type of data, a specific instance of the general case is executed. Polymorphism is subdivided in two concepts Compile Time( static) polymorphism and Run…

Read More