C++: Inheritance on template specialization

When you implement something like:

/* 1 */ template <typename T> class MyClass { ... }; //template class for every T

/* 2 */ template <> class MyClass<char> { ... };  //template class full specialization for T=char

You are saying the C++ compiler: “Please, use the first template for all the MyClass<T> instances with any T except for the MyClass<T> instances where T = char”.
Continue reading “C++: Inheritance on template specialization”

C++: First message

#include <iostream>
#include <string>

using namespace std;

int main()
{
  string greeting = "Ifmmp!xpsme\"";
  
  for (string::const_iterator i = greeting.begin(); i != greeting.end(); ++i)
       cout << static_cast<char>((*i) - 1);
  
  cout << endl;
  return 0;
}

Hello, in this blog I want to publish some interesting information about C++ and other related topics (object oriented programming, generic programming, etc.); the idea is having this information useful and very accurate; so, since I am a fan of these topics but I am far from being an expert on them, I want you all to help me to improve the accuracy of every post I will write; therefore, your comments and suggestions will be really appreciated and will let me make the content of this blog better and better every day. Welcome and thank you for reading me.