The way to write extended classes in Java and C# differs slightly.
Just for the record the following cases depicts the differences.
The extended class -- the case with Java:
public class NewClassTest
{
class A
{
int i=0;
A(int i)
{
this.i=i;
}
}
class B extends A
{
B()
{
super(1);
}
}
public void test()
{
System.out.println(new B().i);
}
public static void main(String args[])
{
new NewClassTest().test();
}
}
The extended class -- the case with C#:
class Class1
{
protected string value = "to be overwritten";
public Class1(string convert)
{
value = convert;
}
}
class Class2 : Class1
{
public Class2(string additional, string convert)
: base(convert)
{
value = convert + additional;
}
public string value { get; set; }
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Class2 test = new Class2(" additional text", "original text");
label1.Text = test.value;
}
}