Hi,
This is about "templates vs inheritance" (please, before you flame me, I do
understand that they cover largely non-intersecting domains).
Apart from D&E*, I've found either online discussions filled with a lot of
"noise" which is very distracting, or literature that doesn't specifically
"compare" the two. I do have access to resources that address the two topics
individually, and I'm wondering if you have any recommendations on which
ones I should look at for a study I'm doing on comparing the two.
All help will be duly credited/acknowledged, of course.
And yes, I have looked at the C++ faq-lite ...
many thanks,
--ravi.
* The Design and Evolution of C++, Bjarne Stroustrup 6 2099
Hi, Apart from D&E*, I've found either online discussions filled with a lot of "noise" which is very distracting, or literature that doesn't specifically "compare" the two. I do have access to resources that address the two topics individually, and I'm wondering if you have any recommendations on which ones I should look at for a study I'm doing on comparing the two.
Take a look at Scott Meyers' book "Effective C++"
( http://www.amazon.com/gp/product/020...lance&n=283155)
on page 185 you can find some very interesting infromation about the
differnces.
Bye,
Sebastian
If you are interested in learning how templates and inheritance can
work together then "Modern C++ Design: Generic Programming and Design
Patterns Applied" by Andrei Alexandrescu is a must read. Actually, it's
probably a must read anyway. It's a perspective-changing book.
Ravi Rao wrote: Hi,
This is about "templates vs inheritance" (please, before you flame me, I do understand that they cover largely non-intersecting domains).
Apart from D&E*, I've found either online discussions filled with a lot of "noise" which is very distracting, or literature that doesn't specifically "compare" the two. I do have access to resources that address the two topics individually, and I'm wondering if you have any recommendations on which ones I should look at for a study I'm doing on comparing the two.
All help will be duly credited/acknowledged, of course.
And yes, I have looked at the C++ faq-lite ...
many thanks,
--ravi.
* The Design and Evolution of C++, Bjarne Stroustrup
Check out C++ Templates: The Complete Guide which discusses this
distinction.
Greg wrote: If you are interested in learning how templates and inheritance can work together then "Modern C++ Design: Generic Programming and Design Patterns Applied" by Andrei Alexandrescu is a must read. Actually, it's probably a must read anyway. It's a perspective-changing book.
I have read some reviews on this book and many of them stated that it is
certainly not modern c++ techniques that it is too academic and
unuseful for real coding. What do you think?
More recommended was C++ Templates: The Complete Guide
Try _Multi-Paradim Design for C++_.
HTH,
Noel
Viktor Prehnal wrote: Greg wrote: If you are interested in learning how templates and inheritance can work together then "Modern C++ Design: Generic Programming and Design Patterns Applied" by Andrei Alexandrescu is a must read. Actually, it's probably a must read anyway. It's a perspective-changing book. I have read some reviews on this book and many of them stated that it is certainly not modern c++ techniques that it is too academic and unuseful for real coding. What do you think?
Personally I found it very informative and humbling.
The book is heavily templates biased, and discusses the opportunities
for code design that they bring. Possibly the name of the book is not
as informative as it could be.
The supplied library, Loki, is very good also, it aids you to implement
various patterns, encapsulating most of the templating nightmare
required to implement. It also has very good descriptions of those
patterns. I prefer it to the GoF where their concerns cross over,
because it's more pragmatic.
It's worth the price for either of the chapters on policy based design
or smart pointers alone.
Check out the smart pointers chapter at the bottom of this page: http://www.awprofessional.com/bookst...201704315&rl=1
OK, so now you must buy it for the chapter on policy-based design!
Ben Pope This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Meng |
last post by:
hi all,
I'm a newbie Python programmer with a C++ brain inside. I have a
lightweight framework in which I design a base class and expect user to
extend. In other part of the framework, I heavily use the instance of
this base class (or its children class). How can I ensure the instance
IS-A base class instance, since Python is a fully dynamic...
|
by: Markus Seeger |
last post by:
Hi,
I'm writing a commandline argument parser that can handle switches
by using some techniques similar to the Qt slot mechanism.
example:
// inheritance method (what I'm trying at the moment)
parser.setSwitch(BoolSwitch("v", "verbose", &bVerbose));
parser.setSwitch(GeometrySwitch("s", "size", &sizeGeometry));
|
by: davidrubin |
last post by:
Structural inheritance (inheriting implementation) is equivalent to
composition in that a particular method must either call 'Base::foo' or
invoke 'base.foo'. Apparantly, The Literature tells us to prefer
composition over inheritance. Can anyone provide some reasons why this
is the case (based on "real-world" experience)? For example, is...
|
by: darkstorm |
last post by:
I have a doubt regarding inheritance involving templates
Consider this:
/////////////////////////////////////
template<typename T>
class A
{
private:
T m_a;
|
by: makc.the.great |
last post by:
now that I am looking at templates, there's the question.
why same effect couldn't/shouldn't be achieved with inheritance?
provided the difference of the two, when and where do I use templates
instead of inheritance, and other way around?
thoughts, please.
| |
by: Peter Oliphant |
last post by:
Is there any plan to support templates with managed code in the (near)
future? For instance, VS.NET 2005... : )
|
by: qning88 |
last post by:
I would like to find out how I can effectively make use of templates in
theexample below.
In Class A, I have 3 overloaded member functions "send" for handling
the different messages. Although the messages are different, the way to
handle the message is the same. Hence I'm thinking of using templates
to reduce the number of lines in the...
|
by: Ted |
last post by:
I'm putting the posts that follow here (hopefully they will follow here!) because
they were rejected in comp.lang.c++.moderated. It behooves anyone reading
them to first read the the thread of the same subject in clc++m to get the more
of the context.
Ted
|
by: Lars Hillebrand |
last post by:
Hello,
i discovered a weird behaviour if i use templates together with virtual
inheritance and method over. I managed to reproduce my problem with a
small example:
// *********** <code example**********
template<typename Tclass TypedInterface
{
public:
virtual void TestFunction( T * ) = 0;
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |