Modelling features of object-oriented languages in second order functional languages with subtypes