Polymorphism (C#)
Në shqip: Polimorfizmi në C#
ShpjegimiSQ
Polimorfizmi do të thotë që një listë me Forma mund të ketë rrathë dhe katrorë, dhe forma.Siperfaqja() thërret versionin e duhur për secilin.
EnglishEN
Polymorphism means a list of Shapes can hold circles and squares, and shape.Area() calls the right version for each.
Si ta mendosh
Si „luaj!“ që secili instrument e luan ndryshe.
Lexoje në anglisht
Like “play!” — each instrument plays it differently.
Shembull kodicsharp
List<Forma> format = [new Rreth(1), new Katror(2)];
foreach (var f in format) Console.WriteLine(f.Siperfaqja());