Hi
I have read about inheritance and templates. What I have understood is that,both of them provide reusabilty of code, then what is the basic difference between them and which one should be used in what conditions?
Please help with example
Thanks
This is a discussion on Difference between using Inheritance and Templates within the C++ Programming forums, part of the General Programming Boards category; Hi I have read about inheritance and templates. What I have understood is that,both of them provide reusabilty of code, ...
Hi
I have read about inheritance and templates. What I have understood is that,both of them provide reusabilty of code, then what is the basic difference between them and which one should be used in what conditions?
Please help with example
Thanks
IMO
Through inheritance you can reuse the *features* of a particular entity.
and
Through templates you can reuse the *functions* defined for interaction with that entity.