c# - Constraints on parameter to implement two interfaces -
i'm trying understand workings of abap-oo.
in c# possible restrict type type conform @ least (multiple) interfaces through constraints in generics doing:
where t : iaminterfacea, iaminterfaceb
is possible archive same in abap-oo? want pass in object parameter method conforms 2 interfaces.
for example want have 2 interfaces:
- ivalidate
- isaveable
i not want have interface combining methods 2 provide separately.
for example there manager class wants save objects if they're valid:
manager.save(/* <object conforms both interfaces ivalidate , isaveable> */ );
so if got simple class simpledata : ivalidate, isaveable
objects of class passed method object class implements isaveable
cannot passed in.
in c# define save method generic method:
static bool save<t>(t dataobject) t : ivalidate, isaveable { /* ... */ }
how in abap-oo, if possible?
in abap, have either create combining interface or check condition @ run-time (which not advise). can use single type parameter. more complex constraints ones quoted not possible far know.
Comments
Post a Comment