Saturday, October 29, 2011
virtual function
In Java a function can be made virtual by just attaching the keyword virtual to implement polymorphism.Eg:-
class any
{
int a;
float b;
virtual void show()
{
System.out.println("a="+a+"\n b="+b);
}
}
class many extends any
{
int a1;
float b1;
void show()
{
Syatem.out.println("a="+a+"\n b="+b);
}
public static void main()
{
any *ptr;
many *ptr1;
ptr=&ptr1;
ptr->show();
ptr->show();
}
}
Subscribe to:
Post Comments (Atom)
-
Hi Guys , In this blog I will share information related to error : can't bind to 'formcontrol' since it isn't a known pr...
-
Hi Guys , This blog is about the error " Target container is not a DOM element. " The full error in the console log is ...
-
Hi Guys , In this blog I will share information related to error : ReferenceError: MongoClient is not defined . This error is related...
No comments:
Post a Comment