In Java if you were to have the statement:
public class MyClass implements LargerClass {
Would you be extending the LargerClass with more methods?
What would be the equivalent of this class definition in C#?
I ask because I am not very familiar with Java and am currently converting some Java code to C# code and this one is giving me some trouble.
Thanks in advance.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
public class MyClass implements LargerClass
In Java, this declares that MyClass
implements the interface LargerClass
; that is, sets out implementations for the behaviours defined in LargerClass
.
To inherit from another class in Java, use extends
, e.g.
public class MyClass extends LargerClass
The C# equivalent, in both cases, is specified as
public class MyClass : LargerClass
Since this syntax doesn't make it clear whether or not LargerClass
is an interface or another class being inherited, you'll find C#/.NET developers adopt the convention that interface names are prefixed with uppercase "I", e.g. IEnumerable
.
public class MyClass : LargerClass { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With