version with inheritance, separate input-result types