Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can you overload a method of class A in Class B if it is
derived class of A?If it is yes tell me how is it possible?

Answers were Sorted based on User's Feedback



can you overload a method of class A in Class B if it is derived class of A?If it is yes tell me ho..

Answer / lalit pradhan

namespace Test
{
class Program
{
static void Main(string[] args)
{
A a = new A();
a.Method();

B b = new B();
b.Method("From B");

Console.ReadKey();
}
}

class A
{
public void Method()
{
Console.WriteLine("From A");
}
}

class B : A
{
public void Method(string s)
{
Console.WriteLine(s);
}
}
}

Is This Answer Correct ?    15 Yes 1 No

can you overload a method of class A in Class B if it is derived class of A?If it is yes tell me ho..

Answer / dhanunjaya

yes,we can overload.Most of the times we can overload a
method within same class only but overloading is possible
between classes.So internally overloading is possible in
class B.

Is This Answer Correct ?    9 Yes 0 No

can you overload a method of class A in Class B if it is derived class of A?If it is yes tell me ho..

Answer / bhagyashri

C# Support Inheritance & in C# multiple inheritance is
achieved by using interface.multiple interface means one
class can derived by two class..and class can be derived
only one class but more than one interface.so for multiple
inheritance we use interface
for eg:
interface i1
{
public void Method1();

}
interface i2
{
public void Method2();

}
class A:i1,i2
{
public void Method1()
{
Console.WriteLine("Hi");
}
public void Method2()
{
Console.WriteLine("Hello");
}
}
class main()
{
public static void Main()
{
A a=new A();
a.Method1();
a.Method2();
Console.ReadLine();
}
}

Is This Answer Correct ?    1 Yes 0 No

can you overload a method of class A in Class B if it is derived class of A?If it is yes tell me ho..

Answer / muralik.it

for the above answers, i have one doubt, c# doesnt support
inheritence instead of that we use interface..but the above
answers showing the inheritence can u plz clarifyit..thank you

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Sharp Interview Questions

Difference between string and stringbuilder?

3 Answers   HCL, Siemens, TCS,


What is Delay Signing?

1 Answers   ACS,


what is a enumeration in c#

0 Answers   Cognizant,


Can variables defined in interface. If yes how we can call/use it in class.

2 Answers   Synechron,


Hi Everyone, the design of the form disappear during writing codes for dataset and data grid. The error show in "line of assigning dataset". I don't know what's happen. If anyone know , please share of technical help from someone. Thanks, Horace Trever

1 Answers  


What are anonymous types in c#?

0 Answers  


What is an int c#?

0 Answers  


Why is xml called extensible?

0 Answers  


int a = '3' + '4'; char n = (char)a; What will be answer of n?

4 Answers  


What are the properties of string?

0 Answers  


Is arraylist type safe in c#?

0 Answers  


What are strong name assemblies?

0 Answers   CitiusTech,


Categories