Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #8159
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Thomas Boell <tboell@domain.invalid> |
| Newsgroups | comp.lang.c++ |
| Subject | Re: duct typing and interface in C++ |
| Date | Mon, 25 Jul 2011 02:05:58 +0200 |
| Organization | albasani.net |
| Lines | 28 |
| Message-ID | <20110725020558.4d424db4@arcadia> (permalink) |
| References | <ivqtf8-ke1.ln1@rama.nodalpoint.universe> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net AextcE4WmsDV3MlMscz0L/GHnS/7J6Y/m+tRhQvx2sbzUHnHUTqzjPEq1c1FkFrUG+sd0Ty6b9ThN0HeuuaqWPSxSAo3oBK7OXloLzXvEkTDs9+tpMRqk5YmDJfiEw5V |
| NNTP-Posting-Date | Mon, 25 Jul 2011 00:05:58 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="1N2tqih/PFFonOjvLf9WIePS/mUriy9HkIdjNrGcT6eX1L19LP4Q94EUhFT69ip7poBrNF4CMeQsdGPVVIRi7ju5L4ZJZZ06yAqR02zbXq0dHCY0J00TcS2gpNtVEp3D"; mail-complaints-to="abuse@albasani.net" |
| X-Newsreader | Claws Mail 3.7.9 (GTK+ 2.24.4; i686-pc-linux-gnu) |
| Cancel-Lock | sha1:7u7wroCxbp29AjXynz906ZU5ru0= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c++:8159 |
Show key headers only | View raw
On Sun, 24 Jul 2011 17:40:02 +0200 TP <Tribulations@Paralleles.invalid> wrote: > Hello, > > I convert a Python/Qt program (PyQt) in C++/Qt. > The programmer has used the duck typing of Python, thus I would like to have > duck typing in C++, in fact exactly what is described in the "best answer" > at the following address: > > http://stackoverflow.com/questions/289176/how-is-duck-typing-different-from- > the-old-variant-type-and-or-interfaces > > (the "best answer" is the second post of the page, the one with a green > sign). > > Is it possible in C++? Well you could create something where you basically stuff your function pointers into a std::map (similar in use to a hash), then look them up by name and call them. This way, the compiler will not be able to tell you if you make a typo. The call will then fail (i. e. segfault) at runtime. If that's what you want...
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-24 17:40 +0200
Re: duct typing and interface in C++ Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-07-24 18:11 +0200
Re: duct typing and interface in C++ Marcel Müller <news.5.maazl@spamgourmet.org> - 2011-07-25 00:03 +0200
Re: duct typing and interface in C++ Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-07-25 10:11 +0200
Re: duct typing and interface in C++ Goran <goran.pusic@gmail.com> - 2011-07-25 04:18 -0700
Re: duct typing and interface in C++ Nobody <nobody@nowhere.com> - 2011-07-24 17:39 +0100
Re: duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-24 19:55 +0200
Re: duct typing and interface in C++ Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-07-24 20:11 +0200
Re: duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-24 20:23 +0200
Re: duct typing and interface in C++ Dombo <dombo@disposable.invalid> - 2011-07-24 20:45 +0200
Re: duct typing and interface in C++ Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-07-24 21:10 +0200
Re: duct typing and interface in C++ Nobody <nobody@nowhere.com> - 2011-07-24 21:21 +0100
Re: duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-24 23:50 +0200
Re: duct typing and interface in C++ Stuart Redmann <DerTopper@web.de> - 2011-07-24 23:33 -0700
Re: duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-25 23:00 +0200
Re: duct typing and interface in C++ Paavo Helde <myfirstname@osa.pri.ee> - 2011-07-25 01:35 -0500
Re: duct typing and interface in C++ Goran <goran.pusic@gmail.com> - 2011-07-25 04:10 -0700
Re: duct typing and interface in C++ James Kanze <james.kanze@gmail.com> - 2011-07-30 11:51 -0700
Re: duct typing and interface in C++ Dombo <dombo@disposable.invalid> - 2011-07-24 20:21 +0200
Re: duct typing and interface in C++ Dombo <dombo@disposable.invalid> - 2011-07-24 20:26 +0200
Re: duct typing and interface in C++ Dombo <dombo@disposable.invalid> - 2011-07-24 18:36 +0200
Re: duct typing and interface in C++ BGB <cr88192@hotmail.com> - 2011-07-24 10:02 -0700
Re: duct typing and interface in C++ BGB <cr88192@hotmail.com> - 2011-07-24 09:45 -0700
Re: duct typing and interface in C++ TP <Tribulations@Paralleles.invalid> - 2011-07-24 20:15 +0200
Re: duct typing and interface in C++ BGB <cr88192@hotmail.com> - 2011-07-24 14:06 -0700
Re: duct typing and interface in C++ Thomas Boell <tboell@domain.invalid> - 2011-07-25 02:05 +0200
Re: duct typing and interface in C++ Qi <no@no.no> - 2011-07-25 09:54 +0800
Re: duct typing and interface in C++ Werner Erasmus <werasm@gmail.com> - 2011-07-25 23:36 +0200
Re: duct typing and interface in C++ Leigh Johnston <leigh@i42.co.uk> - 2011-07-25 23:22 +0100
Re: duct typing and interface in C++ Werner Erasmus <werasm@gmail.com> - 2011-07-26 08:35 +0200
csiph-web