write the Syntax for Function or Method Overriding?
Answers were Sorted based on User's Feedback
Answer / ashish gupta
class base
{
public virtual func()
{
}
}
class derive:base
{
//override the base funcion..signature n return value
// must be same
public override func()
{
}
}
Is This Answer Correct ? | 19 Yes | 3 No |
Answer / 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 |
Answer / nageswari
void function name(aruments)
{
statements
return()
}
Is This Answer Correct ? | 0 Yes | 8 No |
Answer / madhu nagidi
//Below is syntax for function
function test_func()
{
}
//Below is syntax for Method Overriding
Class JJ
{
Test_method(string a, string b)
{
a="Google";
}
}
class MM : JJ
{
Test_method(string a, string b)
{
a = "Micorsoft";
}
}
//Here overriding the functionality of the method which is
in Base Class.
Is This Answer Correct ? | 1 Yes | 11 No |
How will you allow a class to be inherited, but prevent the method from being over-ridden?
How can I develop an application that automatically updates itself from the web?
What is parse method in c#?
6. If we assign a value in textbox on Page_UnLoad event, will it display?
What is the default value of object in c#?
How do you specify a custom attribute for the entire assembly?
Wats the diff between sealed class and private class in inheritance
How can it prevents DLL Hell assembly versioning in .NET?
What is #region in c#?
What is cookies c#?
How do you achieve polymorphism in c#?
What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?