implemented double dispatch for print(); methods are specified with