Re: Why static pure virtual method is not possible?
From: Mike Smith (mike_UNDERSCORE_smith_at_acm.DOT.org)
Date: 03/10/04
- Next message: Mike Smith: "Re: How to build C++ app which accesses SQL database"
- Previous message: Andre Kostur: "Re: Why static pure virtual method is not possible?"
- In reply to: Daniel LAUGT: "Re: Why static pure virtual method is not possible?"
- Next in thread: jeffc: "Re: Why static pure virtual method is not possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 10 Mar 2004 17:09:10 -0500
Daniel LAUGT wrote:
> I have given only a simple example to express my problem.
> Now if my code is:
>
> void testFunction(Telegram *telegram)
> {
> if (telegram->getType() == LoginTelegram::getType())
> << specific login statements >>
> else if (telegram->getType() == LocationTelegram::getType())
> << specific location statements >>
> }
>
> Waht do you make?
Why not make TestFunction a virtual (optionally pure virtual) member
function of the base class Telegram, and get rid of the type checking
(or, rather, let the language do it for you)? *That's what it's there for.*
-- Mike Smith
- Next message: Mike Smith: "Re: How to build C++ app which accesses SQL database"
- Previous message: Andre Kostur: "Re: Why static pure virtual method is not possible?"
- In reply to: Daniel LAUGT: "Re: Why static pure virtual method is not possible?"
- Next in thread: jeffc: "Re: Why static pure virtual method is not possible?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|