What are the merits and demerits of defining and declaring a pure virtual function in a program?

1 answer

Answer

1097941

2026-02-20 03:10

+ Follow

Merits of defining a pure virtual function: It enforces derived classes to implement the function, ensuring polymorphic behavior. It enables abstract classes to define a common interface. Demerits: It can hinder flexibility as derived classes must implement the function. It may also increase code complexity.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.