Required
The Required
aspect can be used to mark a constructor to be "required", matching the required
keyword in Swift, for other languages. If a constructor is marked as required, subclasses must re-implement a matching constructor, and cannot simply inherit it.
type
MyProperties = public class
public
[Required]
constructor withName(aName: String);
end;
public class MyClass
{
[Required]
public this withName(string name) {
}
}
public class MyClass {
public required init(name: String) { // using the keyword
}
@Required public init(number: Int32) { // using the aspect
}
}
public class MyClass {
@Required public this withName(string name) {
}
}