Difference between revisions of "Polymorphism"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:OOP Category:Extreme Programming Category:CSharp if you want to use a method or property of a base class differently in child classes you need polymorphi...")
 
m (1 revision imported)
(No difference)

Revision as of 14:27, 9 May 2016


if you want to use a method or property of a base class differently in child classes you need polymorphism.

Simply add virtual keyword to base class's method

public virtual void Gazla(int ivme)
{
 this.Hiz += ivme;
}

in child class

public override void Gazla(int icme)
{
 // base.Gazla // to use base method as it is
  this.hiz += 2 * ivme;
}