Hi, I was thinking of writing this post as a reply of [URL="http://www.daniweb.com/software-development/cpp/threads/375854"]Need small example for compile time polymorphism and runtime polymorphism in c++.[/URL] But later decided to open this new thread as some expert may want to give some expert opinion on this. On the above mentioned thread, mike_2000_17 has given some example of c++ static/dynamic polymorphism. I have gave an example of java static polymorphism. Here is another way to write static polymorphism in C++ using [URL="http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern"]CRTP[/URL] Idiom. I have used same classes in this post what we have used in the above thread. [CODE] template <typename T> …

Member Avatar
+2 forum 0

Mike_2000_17 and Narue Just a thought: You should write a beginner's tutorial on C++0x for Daniweb. That will be a great way to promote this site. I can also contribute on some easier topics!!.

Member Avatar
Member Avatar
+1 forum 3

This is just for fun and to see how people do it, it will help me to learn different techniques also. If no one answers i will understand. :) Lets say you have a template class. You want a certain method of this class will have some sort of checking mechanism before doing a operation. Different types of object need different kinds of checking. User of this class know whether he needs to do the check or not. If he needs to do the check then he has to provide a function to this template which template class will call …

Member Avatar
Member Avatar
+0 forum 7

The End.