Re: Why doesn't this multiple virtual inheritance code compile?
"Chris Stankevitz" <chrisstankevitz@gmail.com> wrote in message
news:d86e4d32-6781-4cf9-a85a-b806c4325764@r5g2000yqc.googlegroups.com...
On Jan 2, 1:36 pm, Paavo Helde <myfirstn...@osa.pri.ee> wrote:
You could try to make this 'public virtual Observer'.
Thank you, yes I overlooked this. Although this does not help the
compile problem.
That said, I'm not at all convinced that virtual inheritance is the right
approach here.
Me too -- if it doesn't compile, it probably is not the correct
approach!
How would you go about accomplishing this with C++, if it is possible:
- Create an abstract base class "Shape" that must be an "Observer"
- Create an class "Square" that is a "Shape" and uses "ObserverImp"
to implement the "Observer" behavior.
I don't see the problem here , maybe I am missing something.....
<code>
class observer{
public:
virtual void Notify()=0;
};
class observerImp:public observer{
public:
virtual void Notify(){;}
};
class Shape:public observerImp{};
class Square: public Shape{ };
int main(){
Shape* shp = new Square;
shp->Notify();
return 0;
}
</code>
Do you really need Shape to be abstract?
--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---