Please help What is wrong with the following code What is wr

Please help

What is wrong with the following code?

What is wrong with the following code? Public class C public virtual void func1() {} public class D public virtual void func1() {} public class E: C, D public override void func1() {}

Solution

public class C

{

public virtual void fonc1(){

} ------->this is a concrete class which has own implementation of func1..

Concrete class is nothing but normal class, we can use as a base class or may not.Not compulsory, it can\'t contain abstract methods.we can create object and work with this class.

public class D

{

public virtual void func1(){

}

} ------>this is also a concrete class which has own implementation of func1..

public class E:C,D

{

public override void func1(){

}

}------->class E is subclass or derived class which extends both class C and D.

As, both C,D had func1

As we already Know that we canot have multiple inheritance in c#.for this type of problems we use interfaces..

if suppose E defines a function func1 .here conflict arise which class function func1 should be implemented between C and D.it is error.

Please help What is wrong with the following code? What is wrong with the following code? Public class C public virtual void func1() {} public class D public vi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site