Lesson 29 of 34
Polymorphism, Abstract Classes, Interfaces
11 min 35 XP
Abstract class-லிருந்து நேரடியாக object உருவாக்க முடியாது; அதன் abstract methods-ஐ child classes எழுத வேண்டும். Interface என்பது ஒப்பந்தம்: implements செய்யும் 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, overloading = compile-time.