Lesson 29 of 34
Polymorphism, Abstract Classes, Interfaces
11 min 35 XP
Abstract class-ന്റെ objects ഉണ്ടാക്കാനാവില്ല; child classes അതിന്റെ abstract methods എഴുതണം. Interface ഒരു കരാറാണ്: അത് implement ചെയ്യുന്ന class അതിന്റെ എല്ലാ methods-ഉം എഴുതണം, ഒരു class-ന് പല interfaces implement ചെയ്യാം.
Example: edit me and press Run
Press Run to see the result here.Example: edit me and press Run
Press Run to see the result here.Shape s = new Circle(...) എന്നത് runtime polymorphism ആണ്: variable-ന്റെ type Shape, പക്ഷേ Circle-ന്റെ area() ആണ് പ്രവർത്തിക്കുന്നത്. Overriding runtime polymorphism; overloading compile-time.