> Limitations page, although thinking about it I came to the conclusion > it would be awfully hard to implement (maybe I'm wrong). It's something It is not too hard to implement in any particular platform/compiler But there is a lot of them, hence it would be a huge work for Masaharu to imlement all of them. But theoretically it is possible and even described in books. For example in "Advanced C++, James O. Coplien" Victor George Heintzelman wrote: > > Hi, > > Is inheriting virtual member functions from a compiled class supposed > to work correctly in CINT? I couldn't find it listed in CINT's > Limitations page, although thinking about it I came to the conclusion > it would be awfully hard to implement (maybe I'm wrong). It's something > that would be extremely useful for us though, so I thought I'd ask. > here's an example: > > file ~/test/derive.C: > --------------------------- > class TBlah : public TObject { > public: > TBlah(); > virtual void Print(Option_t *opt); > }; > > inline TBlah::TBlah() {} > > void TBlah::Print(Option_t *opt) { > printf("TBlah's Print thing.\n"); > } > ----------------------------- > Root session (in this case, 2.23/09 on a Solaris machine) > > root [0] .L ~/test/derive.C > root [1] TBlah a > root [2] a.Print() > OBJ: TObject TObject Basic ROOT object > root [3] a.Print("test") > TBlah's Print thing. > root [4] TObject *b=&a > root [5] b.Print() > OBJ: TObject TObject Basic ROOT object > root [6] b.Print("test") > OBJ: TObject TObject Basic ROOT object > root [7] > ------------------------------ > Line 2 is not correct, but probably an easy fix having to do with > propagating default arguments from base class headers, since Print > takes a default argument of NULL declared in TObject.h. Line 3 means > CINT works correctly when it knows the type of the pointer, as I would > expect. > > Line 6 is the serious one, since it means that the interpreted derived > class's virtualness isn't available to CINT. Is there any chance of > this getting fixed? Otherwise being able to declare derived classes > interpretively from compiled base classes is almost useless (and > certainly ought to warrant a warning when doing it, or at least when > overriding virtual functions, since otherwise some very non-intuitive > behavior could result). > > George Heintzelman > gah@bnl.gov -- Victor M. Perevoztchikov perev@bnl.gov perev@vxcern.cern.ch Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000 tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET