template specialization -> 'too few template-parameter-lists'

i can't find what's wrong with this code:

template <class T>
class B{
    T _t;
public:
    B(T t) : _t(t) {}
    void printHello();
};

template <class T>
void B<T>::printHello(){
    std::cout << "Hello";
}
void B<char*>::printHello(){
    std::cout <<"Good bye!";
}

I keep getting:

'error: too few template-parameter-lists'

Answers


template<> is missing before the specialization

template<>
void B<char*>::printHello(){
    std::cout <<"Good bye!";
}

Need Your Help

When would Visual Studio for Mac OS X /Objective C finally released as announced by Steve Ballmer?

iphone objective-c visual-studio osx

As I read here http://www.sdtimes.com/MAC_DEVELOPERS_EMBRACE_NET_WITH_VISUAL_OBJECTIVE_C/By_I_B__Phoolen/34234

Pre-loading Azure web-site to increase first visit load time

c# webforms azure-web-sites asp.net-4.5

I am right now in the middle of creating a new web application for Azure.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.