A virtual function is a member function declared in a base class that is re-defined (overridden) by a derived class. When you use a pointer or a reference to the base class to refer to a derived class object, you can call a virtual function for that object and execute the derived class’s version of […]
October 26, 2022 | C++ | No comments
Exception Handling with Method Overriding: Ambiguity arises when method overriding and exception handling are combined. Which definition should be followed confuses the compiler. Problem categories: It has two different kinds of issues, which are as follows: Problem 1: If The SuperClass doesn’t declare an exception Problem 2: If The SuperClass declares an exception If The […]
June 25, 2022 | Java | No comments