camelCase
The Case of the Mysterious Camel.
- Reaction score
- 362
I have something like this:
The problem is class "OhMyGawdWhatAmIDoing" (It, too is abstract).
It implements the pure virtual method and it's doSomething() implementation calls the doSomething() method of both Derived_Abstract and Derived.
The thing is, it'll inherit Derived_Abstract's doSomething() implementation by default (something about dominance; some compiler warning). This generates a warning and I don't like to see warnings =/
My current solution is ugly but it gets rid of the warning:
So, no more diamond inheritance and doSomething() can call the doSomething() method of both classes.
But it seems kinda' ugly, I duno.
Any way around this?
Code:
class Base {
public:
virtual void doSomething ();
};
class Derived_Abstract {
public:
virtual void doSomething ();
virtual void abstractStuff () = 0;
};
class Derived {
public:
virtual void doSomething ();
};
class OhMyGawdWhatAmIDoing : public Derived_Abstract, public Derived {
public:
virtual void doSomething ();
virtual void abstractStuff () = 0;
};
The problem is class "OhMyGawdWhatAmIDoing" (It, too is abstract).
It implements the pure virtual method and it's doSomething() implementation calls the doSomething() method of both Derived_Abstract and Derived.
The thing is, it'll inherit Derived_Abstract's doSomething() implementation by default (something about dominance; some compiler warning). This generates a warning and I don't like to see warnings =/
My current solution is ugly but it gets rid of the warning:
Code:
class OhMyGawdWhatAmIDoing : public Derived_Abstract {
public:
virtual void doSomething ();
virtual void abstractStuff () = 0;
protected:
Derived d; //Tadah
};
But it seems kinda' ugly, I duno.
Any way around this?