class A{
public:
virtual void fun(){
cout<<"base ";
}
};
class B: public A{
public:
void fun(){
cout<<"derived ";
}
};
int main(){
A *a=new B;
a->fun();
return 0;
}
Code Example |
---|
Cpp :: c++ cin accept only numbers |
Cpp :: Overloading IO Stream |
Cpp :: hello command not printing in c++ |
Cpp :: http://dcnet.ddns.ma/Connecter_Tuteur |
Cpp :: geekforgeeks stacks |
Cpp :: how to get the numbers in a vector c++ sfml |
Cpp :: Stack Modified |
Cpp :: double pointers C++ |
Cpp :: c++ function parameters |
Cpp :: c++ array on heap |
Cpp :: default access specifier in c++ |
Cpp :: cpp queue |
Cpp :: c++ define constant |
Cpp :: Arduino Counting |
Cpp :: call by value in c++ |
Cpp :: cout<<"helloworld"<<endl problem |
C :: c colourful output |
C :: how to store a user input with spaces in c |
C :: Animated sprite from few images pygame |
C :: imprimir valor no octave |
C :: sdl_renderfillrect |
C :: boilerplate code c |
C :: random in c |
C :: 0/1 knapsack problem in c |
C :: reverse of a string in c |
C :: c execute shell command |
C :: for loop in c |
C :: print short in c |
C :: casting an int to a char in c |
C :: grepper vscodium |