Four basic principles of Object- Oriented Programming
September 16, 2020
September 16, 2020

Now class Car has it’s own fields and methods, but it can also access all methods of Vehicle class.
Polymorphism: This literally means “many shapes”. In OOP this means and that programmers can change the way that something works by changing the way it is done or just some parts of it. Polymorphism can be static and dynamic. Static is achieved by method overloading, and dynamic by method overriding. Example for method overloading: it is better to overload one method than to write two methods that do the same thing. static int Add(int x, int y){ return x + y; } static double Add(double x, double y){ return x + y; } Example of method overriding: We override methods to tailor it’s functionality to our needs. public string Name {get; set; } public override string ToString(){ return “Person: ” + Name; }