[ACCEPTED]-C# equivalent of Java 'implements' keyword?-java

Accepted answer
Score: 73
public class MyClass implements LargerClass

In Java, this declares that MyClass implements 9 the interface LargerClass; that is, sets out implementations 8 for the behaviours defined in LargerClass.

To inherit from 7 another class in Java, use extends, e.g.

public class MyClass extends LargerClass

The C# equivalent, in 6 both cases, is specified as

public class MyClass : LargerClass

Since this syntax 5 doesn't make it clear whether or not LargerClass is 4 an interface or another class being inherited, you'll 3 find C#/.NET developers adopt the convention 2 that interface names are prefixed with uppercase 1 "I", e.g. IEnumerable.

Score: 8
public class MyClass : LargerClass



Score: 3
public class MyClass : LargerClass {...}


More Related questions