473,545 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Templates vs Inheritance Literature?

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
Nov 30 '05 #1
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

Nov 30 '05 #2
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.

Dec 1 '05 #3
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.
Dec 1 '05 #4
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
Dec 1 '05 #5
Try _Multi-Paradim Design for C++_.

HTH,
Noel

Dec 1 '05 #6
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
Dec 1 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
2795
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...
1
1633
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));
10
2636
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...
3
2535
by: darkstorm | last post by:
I have a doubt regarding inheritance involving templates Consider this: ///////////////////////////////////// template<typename T> class A { private: T m_a;
10
9608
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.
11
1810
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... : )
4
1486
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...
25
3299
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
5
1877
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;
0
7425
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...
0
7682
Oralloy
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. ...
0
7935
jinu1996
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...
0
7780
tracyyun
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...
0
5069
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...
0
3479
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...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
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
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.