[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: c++ question: code duplication across classes
From: Thiago Macieira <thiago () kde ! org>
Date: 2006-09-21 11:43:16
Message-ID: 200609211343.16881.thiago () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Frans Englich wrote:
>----------------------------------------------
>template<int &m_height, int &m_width> class Base
>{
>public:
> // do what you want with m_height/m_width
>
>protected:
> /**
> * @short This class must be sub-classed. For that
> * reason this constructor is protected.
> */
> inline Base() {}
>};
>
>----------------------------------------------
This will require two *global* variables of type int. You can't pass
values.
Remember that the instantiated class will have not the value and not the
pointer address, but the symbol name mangled.
>The idea is to be able to do this:
>
>template<int height, int width>
>class Fixed : public Base <height, width>
>{
>};
Different template types. This is not function calling.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
[Attachment #5 (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic