Polymorphism

In object-oriented programming, the ability of one message or method name to produce different behaviour depending on the class of the object that receives it; unrelated to polymorphic malware.

Polymorphism, from the Greek for “many forms”, is a core feature of object-oriented programming. Several classes can each implement a method with the same name in their own way, and the version that runs is chosen by the class of the object receiving the call, often at run time. A method called calculateFee might apply one rule to a savings account object and another to a loan account object, while the code that calls it stays the same. This commonly works through inheritance, where a subclass overrides a method it received from its parent class.

The security relevance is indirect. Because the caller does not know in advance which implementation will run, a faulty or malicious subclass can substitute its own behaviour for a trusted one, so code that makes security decisions should not rely on overridable methods it has not verified. The word also has an unrelated meaning in malware: polymorphic malware alters its code or encryption with each copy to evade signature-based detection while keeping the same function.

Exam relevance: candidates are expected to match polymorphism to “same message, different behaviour depending on the object’s class”, and to keep it apart from inheritance, which passes characteristics down, and from polymorphic malware, which a scenario about antivirus evasion is more likely to mean.