Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11543

Re: How can I remove dynamic_cast and if statements from this code snippet?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: How can I remove dynamic_cast and if statements from this code snippet?
Date 2011-11-17 11:12 +1300
Message-ID <9iiqq0Fi5oU18@mid.individual.net> (permalink)
References (2 earlier) <cb08fb25-4306-466d-88bb-563752af7160@a16g2000yqk.googlegroups.com> <9iioo8Fi5oU16@mid.individual.net> <fb2a37ad-a131-4aa6-a4eb-1b85d0993f8e@j19g2000pro.googlegroups.com> <9iipskFi5oU17@mid.individual.net> <0a80b56f-6702-494f-8ba4-ddefdf7fcaf2@q39g2000prg.googlegroups.com>

Show all headers | View raw


On 11/17/11 11:03 AM, Chris Stankevitz wrote:
> On Nov 16, 1:56 pm, Ian Collins<ian-n...@hotmail.com>  wrote:
>> You can always replace conditionals with virtual member functions.
>
> I assume in the drawing case you are suggesting I add a virtual
> function "GetVerticies" or a virtual function "Draw".  This is now
> what I want for these reasons:
>
> 1. I have to modify the Shape class to be aware that it is being drawn
> 2. Some shapes cannot be drawn with "verticies" and need to be drawn
> carefully and uniquely -- for example a doughnut that has a hole in
> the middle.

So how would a generic drawing class be expected to know this?  It would 
have to changed for each new shape.

Does your window manager know how to render every type of window on your 
system?

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 10:37 -0800
  Re: How can I remove dynamic_cast and if statements from this code snippet? Ian Collins <ian-news@hotmail.com> - 2011-11-17 07:52 +1300
    Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 11:14 -0800
      Re: How can I remove dynamic_cast and if statements from this code snippet? red floyd <no.spam.here@its.invalid> - 2011-11-16 12:03 -0800
        Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 13:28 -0800
          Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 21:39 +0000
            Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 21:40 +0000
              Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 21:43 +0000
                Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 21:45 +0000
            Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 13:46 -0800
              Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 21:49 +0000
      Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-16 20:35 +0000
        Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 13:38 -0800
      Re: How can I remove dynamic_cast and if statements from this code snippet? Ian Collins <ian-news@hotmail.com> - 2011-11-17 10:37 +1300
        Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 13:41 -0800
          Re: How can I remove dynamic_cast and if statements from this code snippet? Ian Collins <ian-news@hotmail.com> - 2011-11-17 10:56 +1300
            Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 14:03 -0800
              Re: How can I remove dynamic_cast and if statements from this code snippet? Ian Collins <ian-news@hotmail.com> - 2011-11-17 11:12 +1300
                Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-16 15:20 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Werner <werasm@gmail.com> - 2011-11-16 23:39 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-17 05:42 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-17 10:37 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Werner <werasm@gmail.com> - 2011-11-17 23:23 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-18 01:46 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-18 01:25 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Werner <werasm@gmail.com> - 2011-11-17 23:28 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-17 10:27 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-17 05:17 -0800
                Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-17 10:35 -0800
  Re: How can I remove dynamic_cast and if statements from this code snippet? Francesco <xtrigger303@gmail.com> - 2011-11-17 01:56 -0800
    Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-17 10:31 -0800
  Re: How can I remove dynamic_cast and if statements from this code snippet? <address_is@invalid.invalid> - 2011-11-17 19:21 +0000
    Re: How can I remove dynamic_cast and if statements from this code snippet? Leigh Johnston <leigh@i42.co.uk> - 2011-11-17 19:33 +0000
    Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-17 14:09 -0800
      Re: How can I remove dynamic_cast and if statements from this code snippet? Werner <werasm@gmail.com> - 2011-11-17 23:30 -0800
        Re: How can I remove dynamic_cast and if statements from this code snippet? Bart v Ingen Schenau <bart@ingen.ddns.info> - 2011-11-18 14:45 +0100
    Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-18 02:58 -0800
      Re: How can I remove dynamic_cast and if statements from this code snippet? Tobias Müller <troplin@bluewin.ch> - 2011-11-18 16:56 +0000
        Re: How can I remove dynamic_cast and if statements from this code snippet? Chris Stankevitz <chrisstankevitz@gmail.com> - 2011-11-18 17:27 -0800
    Re: How can I remove dynamic_cast and if statements from this code snippet? Goran <goran.pusic@gmail.com> - 2011-11-18 01:29 -0800
  Re: How can I remove dynamic_cast and if statements from this code snippet? Noah Roberts <roberts.noah@gmail.com> - 2011-11-18 09:23 -0800

csiph-web