upcasting in c 2b 2b

Solutions on MaxInterview for upcasting in c 2b 2b by the best coders in the world

showing results for - "upcasting in c 2b 2b"
Juan Pablo
14 Jan 2020
1Upcasting and downcasting are an important part of C++. Upcasting and downcasting give a possibility to build complicated programs with a simple syntax. It can be achieved by using Polymorphism.
2
3C++ allows that a derived class pointer (or reference) to be treated as a base class pointer. This is upcasting.
4
5Downcasting is an opposite process, which consists of converting base class pointer (or reference) to derived class pointer.
6
7C++ Upcasting and Downcasting should not be understood as a simple casting of different data types. It can lead to great confusion.
8
9In this topic, we will use the following hierarchy of classes:
10