Struct Inheritance
In RemObjects Swift, struct
s 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 var a: Int
public func DoSomething() {
..
}
}
MyStruct2 = public struct : MyStruct1 {
public var b: String
public func DoSomethingElse() {
..
}
}
In the example above, MyStruct2
contains all the fields and methods of MyStruct1
, as well as those defined for MyStruct2
itself.