Question:-Oearriding in c++.

 Function Overriding in C++:-

A function is a block of statements that together performs a specific task by taking some input and producing a particular output. Function overriding in C++ is termed as the redefinition of base class function in its derived class with the same signature i.e. return type and parameters. It falls under the category of Runtime Polymorphism.

Real-Life Example of Function Overriding
The best Real-life example of this concept is the Constitution of India. India took the political code, structure, procedures, powers, and duties of government institutions and set out fundamental rights, directive principles, and the duties of citizens of other countries and implemented them on its own; making it the biggest constitution in the world. 

Another Development real-life example could be the relationship between RBI(The Reserve Bank of India) and Other state banks like SBI, PNB, ICICI, etc. Where the RBI passes the same regulatory function and others follow it as it is.


Real-Life Example of Function Overriding
Function Overriding

Syntax:


class Parent{

  access_modifier:

    // overridden function

    return_type name_of_the_function(){}

  };

}

  class child : public Parent {

    access_modifier:

      // overriding function

      return_type name_of_the_function(){}

    };

  }

Comments

Popular posts from this blog