Inheritance

Resource Classes can be extended with the extends keyword - this is most useful for extending standard library features like Lists.

Here’s an example:

use std::List

resource Books extends List<Book> { 
	interface { 
		q? : string, 
		sort?, 
		// Different `?` placement here 
	} 
}

When extending an RC, the new RC (the “child”) cannot have any parameters like generics. The RC that is being extended (the “parent”) must be fully-specified; i.e. all of its parameters must be satisfied.

A Child RC inherits all of the properties - like data declarations, links, and methods - from its parent. Any properties then specified by the Child RC completely override those of the Parent if they exist.

Future Considerations

This is one of the flimsiest features of the current specification and is the most subject to change. If you have any feedback, I’d love to hear it.