Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, January 22, 2020 5:34 AM
Hi All
Please Explain me the difference between extends and implements in C#
Thnnks and regards
siddu
All replies (1)
Wednesday, January 22, 2020 8:20 AM
Both the Java extends and implements keywords are represented in C# by a colon:
Java:
public class Manager extends Person {
...
}
C#:
public class Manager : Person {
...
}
public class Manager implements IPerson {
...
}
C#:
public class Manager : IPerson {
...
}
If a class extends or derives from another class, it inherits all members and implementations from the parent class. If a class implements an interface, it must provide its own implementations for the methods defined by the interface (although in C# 8.0, you can provide default implementations in the interface: /en-us/dotnet/csharp/whats-new/csharp-8#default-interface-methods)