Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13007
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Why doesn't this multiple virtual inheritance code compile? |
| Date | 2012-01-03 11:54 +1300 |
| Message-ID | <9meqt9Ft5pU1@mid.individual.net> (permalink) |
| References | <785a07d6-7cf7-4249-a123-f7d7b4aaa8b3@l24g2000yqm.googlegroups.com> <Xns9FCEF030F32AEmyfirstnameosapriee@216.196.109.131> <d86e4d32-6781-4cf9-a85a-b806c4325764@r5g2000yqc.googlegroups.com> |
On 01/ 3/12 11:41 AM, Chris Stankevitz wrote:
> 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.
If you don't actually require dynamic binding, you could make Observer a
template with Imp as it's parameter:
template <typename Imp> struct Observer
{
void Notify() { Imp::notify(); }
};
struct Imp
{
void Notify() {}
};
struct Shape : Observer<Imp>
{
};
struct Square : Shape
{
};
--
Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-02 12:16 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Paavo Helde <myfirstname@osa.pri.ee> - 2012-01-02 15:36 -0600
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-02 14:41 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Ian Collins <ian-news@hotmail.com> - 2012-01-03 11:54 +1300
Re: Why doesn't this multiple virtual inheritance code compile? "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-02 23:56 +0000
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-02 20:25 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-01-03 12:46 +0100
Re: Why doesn't this multiple virtual inheritance code compile? "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-03 16:34 +0000
Re: Why doesn't this multiple virtual inheritance code compile? Paavo Helde <myfirstname@osa.pri.ee> - 2012-01-03 01:20 -0600
Re: Why doesn't this multiple virtual inheritance code compile? Goran <goran.pusic@gmail.com> - 2012-01-02 23:52 -0800
Re: Why doesn't this multiple virtual inheritance code compile? "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2012-01-03 15:42 +0000
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-03 13:35 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Robert Wessel <robertwessel2@yahoo.com> - 2012-01-02 16:23 -0600
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-02 14:43 -0800
Re: Why doesn't this multiple virtual inheritance code compile? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-03 00:46 +0100
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-02 20:38 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Spike <invalid@invalid.invalid> - 2012-01-03 09:35 +0100
Re: Why doesn't this multiple virtual inheritance code compile? Chris Stankevitz <chrisstankevitz@gmail.com> - 2012-01-03 13:39 -0800
Re: Why doesn't this multiple virtual inheritance code compile? Leigh Johnston <leigh@i42.co.uk> - 2012-01-03 21:51 +0000
Re: Why doesn't this multiple virtual inheritance code compile? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2012-01-04 02:14 +0100
Re: Why doesn't this multiple virtual inheritance code compile? Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 01:19 +0000
Re: Why doesn't this multiple virtual inheritance code compile? Ian Collins <ian-news@hotmail.com> - 2012-01-04 15:15 +1300
Re: Why doesn't this multiple virtual inheritance code compile? Leigh Johnston <leigh@i42.co.uk> - 2012-01-04 02:58 +0000
Re: Why doesn't this multiple virtual inheritance code compile? jgk@panix.com (Joe keane) - 2012-01-04 20:45 +0000
Re: Why doesn't this multiple virtual inheritance code compile? Juha Nieminen <nospam@thanks.invalid> - 2012-01-03 06:26 +0000
Re: Why doesn't this multiple virtual inheritance code compile? jgk@panix.com (Joe keane) - 2012-01-03 14:12 +0000
csiph-web