Example & Tutorial understanding programming in easy ways.

Define final in C++

Final in C++:
-Sometimes you don't want to allow derived class to override the base class' virtual function.
-C++ 11 allows built-in facility to prevent overriding of virtual function using final specifier.


#include < iostream>
using namespace std;
class Base
virtual void myfun() final
cout << "myfun() in Base";
class Derived : public Base
void myfun()
cout << "myfun() in Derivedn";
int main()
Derived d;
Base &b = d;
return 0;


Give some error

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!