Struct Inheritance

In RemObjects C#, structs can specify an ancestor, allowing a newly declared struct to inherit the fields and methods of its base struct. Unlike classes, structs are not polymorphic, and members cannot be virtual or overriden.

MyStruct1 = public struct 
{
    public int a;
    public void DoSomething() 
    {
        ..
    }
}

MyStruct2 = public struct : MyStruct1 
{
    public string b;
    public void DoSomethingElse() 
    {
        ..
    }
}

In the example above, MyStruct2 contains all the fields and methods of MyStruct1, as well as those defined for MyStruct2 itself.

See Also