virtual-functions

C++ vtable resolving with virtual inheritance

I was curious about C++ and virtual inheritance - in particular, the way that vtable conflicts are resolved between bass and child classes. I won't pretend to understand the specifics on how they work, but what I've gleamed so far is that their is a small delay caused by using virtual functions due to that resolution. My question then is...

question about virtual methods in java

Put simply: I want the following code to print "sub": Element e = new SubElement(); print(e); ... private static void print(Element e) { System.out.println("e"); } private static void print(SubElement e) { System.out.println("sub"); } and i dont want to change print(Element e). so nothing like private static void print(El...

Deleting virtual functions in C++0x

It isn't clear what happens if I delete a virtual method in C++0x: virtual int derive_func() = delete; Does this mean this class and everything that inherits from it can not define/implement the derive_func() method? Or is this illegal/compile error? ...

Can I override an overload of an operator and return a different type?

class A{ public: virtual char &operator[](int); protected: .. }; class B:A{ public: A* &operator[](int); protected: } Can I change the return type when I overload an overload of an operator? thanks! //EDIT Okay, so now that we established that this wont work how can I build a work around? Lets say I have classe...

Can child templates stored in a base class array, use an overloaded virtual function?

In hope to simplify a homework problem dealing with inheritance, I thought it might be better to use polymorphism to accomplish the task. It isn't required, but makes much more sense if possible. I am, however, getting symbol errors making it work as I thought it should or just the base class definition is called. I want the overloade...