I'm interested in defining and inheriting from interfaces in R
. By interface, I mean OOP interfaces. I know R
supports class extension. This link http://adv-r.had.co.nz/OO-essentials.html gives an example of extending a reference class in R
. It defines a NoOverdraftAccount
reference class that extends an Account
reference class.
Instead of extending the Account
reference class, I'd like to be able to define an account interface, IAccount
. I would like I'd like NoOverDraftAccount
to implement IAccount
, such that:
NoOverDraftAccount
must implement all methods inIAccount
.NoOverDraftAccount
cannot declare any new public methods not already declared inIAccount
.NoOverDraftAccount
can declare private methods and properties.
What's the best way to achieve this?
The closest I've come to an answer was from the question Multiple inheritance for R6 classes. But, the question wasn't focused on interfaces.
Thanks for your time.