write the Syntax for Function or Method Overriding?

Answer Posted / pritam kumar

class parent
{
public virtual void print()
{
Console.Writeline ("method from parent class");
}
}
class child:parent
{
public override void print()
{
Console.Writeline("method from base class ");
}
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between ref & out parameters in c#?

456


What is polymorphism c# example?

483


What is an example of a delegate?

503


What is a Command Object in C#?

552


What is the data encapsulation?

485






Can you call from an inherited constructor to a specific base constructor if both base class and an inheriting class has a number of overloaded constructors?

520


Is system a class in c#?

489


Can a sealed class be used as a base class?

533


What is readline library?

502


What is the difference between Decorator and Adapter pattern?

523


Explain how to implement delegates in c#.net

499


What is the default value of datetime in c#?

488


Is versioning applicable to private assemblies?

568


Can we extend sealed class in c#?

488


Explain manifest & metadata in c#.

533