[comp.lang.c++] cfront inheritance problem

coleman@bert.dg.com (Kim Coleman) (03/29/89)

On the program below, cfront insists that there is a type mismatch between
virtual function Object::some_method and Collection::some_method. I can't
quite decide if this is a bug or not. It certainly SEEMS like a bug, but I'm
willing to be enlightened if it's just a gap in my understanding. I can see
a case against the implicit conversion of Object& to Collection_Member&
on the basis of Stroustrap only stating there is an implicit conversion
between base and derived pointers. However, cfront doesn't seem to want to
make an implicit conversion between Object* and Collection_Member*, either.


class Object
{
public:
   virtual Object* some_method (const Object&);
};


class Collection_Member : public Object
{};


class Collection : public Object
{
public:
                                 // this is what I WANT to do
   Collection_Member*  some_method (const Collection_Member&);

//
// in desparation, I also tried:
//
                                 // g++ 1.34.1 accepts this form
//   Collection_Member*  some_method (const Object&);
//   Object*             some_method (const Collection_Member&);

                                 // cfront only accepts this form
//   Object*             some_method (const Object&);
};

----------------------------
Kim Coleman
Data General Corp., Research Triangle Park, NC
{the world}!mcnc!rti!dg-rtp!coleman