In the method overloading,there are the signature of the method are change and we are declare at the
compile time so its called method overloading.when the arguments are remain same in all method that is called method overriding.
whenever child class use the parent class method there are nature of the child class is different so the body of the method is change and child class is use for own environment.so the child class redefined the parent class method and after use it.
class paint
{
void draw()
{
System.out.println("this is paint class");
}
}
class circle extends paint
{
void draw()
{
System.out.println("this is circle class");
}
}
class square extends paint
{
void draw()
{
System.out.println("this is square class");
}
}
method overriding also known as run time polymorphism.run time polymorphism also known as late binding or dynamic binding.
compile time so its called method overloading.when the arguments are remain same in all method that is called method overriding.
whenever child class use the parent class method there are nature of the child class is different so the body of the method is change and child class is use for own environment.so the child class redefined the parent class method and after use it.
class paint
{
void draw()
{
System.out.println("this is paint class");
}
}
class circle extends paint
{
void draw()
{
System.out.println("this is circle class");
}
}
class square extends paint
{
void draw()
{
System.out.println("this is square class");
}
}
method overriding also known as run time polymorphism.run time polymorphism also known as late binding or dynamic binding.
No comments :
Post a Comment