Polymorphism is one of the primary concepts of Object Oriented Programming. There are basically two types of polymorphism (i) RunTime (ii) CompileTime. Overriding a virtual method from a parent class in a child class is RunTime polymorphism while CompileTime polymorphism consists of overloading identical functions with different signatures in the same class. This program depicts Run Time Polymorphism.
The method Calculate(int x) is first defined as a virtual function int he parent class & later redefined with the override keyword. Therefore, when the function is called, the override version of the method is used.