Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: dynamic_cast Date: Sat, 07 Aug 2021 13:06:58 -0700 Organization: A noiseless patient Spider Lines: 17 Message-ID: <86eeb52f4t.fsf@linuxsc.com> References: <20210627225136.00005d66@reddwarf.jmc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="0a1d8104bbc0e7f8706fc1dabce7c8e9"; logging-data="18105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8CLf5g/3RnFSFosjv3WQM0kp9zorE3qU=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:/MpQ1OWLqafZ6RtSQ3pUcxMYc8A= sha1:vwx4HLg6str+9Qam8qy1Yzp9oAw= Xref: csiph.com comp.lang.c++:80792 Richard Damon writes: > On 7/3/21 11:01 AM, Bonita Montero wrote: > >>>> If you're doing a dynamic_cast you're switching upon the type of the >>>> class. This switching should be better done inside the class with class >>>> -dependent code - with a virtual function call. >>> >>> Wrong. Application level logic should stay in the application level >>> code. That is the only scalable option. >> >> Virtual function calls are more scalable. > > Wrong, the NUMBER of functions needed grows way to fast to be scalable. It might, but it doesn't have to. The number of functions needed depends on the class hierarchy.