Which two code segments should you use?

You are developing an application that includes the following code segment:

You need to implement both Start() methods in a derived class named UseStart that uses the Start() method of
each interface.
Which two code segments should you use? (Each correct answer presents part of the solution.
Choose two.)

You are developing an application that includes the following code segment:

You need to implement both Start() methods in a derived class named UseStart that uses the Start() method of
each interface.
Which two code segments should you use? (Each correct answer presents part of the solution.
Choose two.)

A.
Option A

B.
Option B

C.
Option C

D.
Option D

E.
Option E

F.
Option F

Explanation:
B:
* Implementing Multiple Interfaces
A class can implement multiple interfaces using the following syntax:
C#
public class CDAndDVDComboPlayer : ICDPlayer, IDVDPlayer
If a class implements more than one interface where there is ambiguity in the names of members, it is resolved
using the full qualifier for the property or method name. In other words, the derived class can resolve the
conflict by using the fully qualified name for the method to indicate to which interface it belongs
* In C#, both inheritance and interface implementation are defined by the : operator, equivalent to extends and
implements in Java. The base class should always be leftmost in the class declaration.



Leave a Reply 17

Your email address will not be published. Required fields are marked *


wer

wer

C, D

bossov

bossov

I agree with D, but why C?

f9p

f9p

B & D, C is not correct because methods in an interface are public and nothing more, however methods in a class are private by default and need to be public to implement them.

f9p

f9p

Sorry, I’m wrong

f9p

f9p

It’s C because ‘public’ modifier is redundant

re

re

No, you were right it’s B & D, by default class methods are private. And Interface methods public.

Ck

Ck

C – Interface methods are public by default

Barhoooom

Barhoooom

The correct answers are C & D

Utsav Gupta

Utsav Gupta

I Agree.
C- because you can’t have access modifiers on explicit interface implementation.

Denis

Denis

that’s right

Steve

Steve

Tested in Visual Studio, with a public modifier it won’t compile

Pascal

Pascal

As for Me B&C is correct, Implicit and Explicit Implementations

hed

hed

if trying to use public like on B I got compilation error:
The modifier ‘public’ is not valid for this item

John

John

It’s C and D, test it.

keyur

keyur

CD confirm using code