int main(void)
{
Screen<2,3> s1;
cout<<s1;
cout<<"please enter 6(chars):";
cin>>s1;
cout<<s1;
return 0;
}
功能描述:
我定义了一个类模板Screen<hi,wid>,想通过类模板中的friend input&output操作符输出Screen<2,3> s1中的内容
但是,友元的定义有问题:
问题1:error C2663: 'get' : 2 overloads have no legal conversion for 'this' pointer
d:\programe\c++ primer\test3\main.cpp(26) : see reference to function template instantiation 'class std::basic_ostream<char,struct std::char_traits<char> > &__cdecl operator <<(class std::basic_ostream<char,struct std::char_traits<char> > &,
const class Screen<2,3> &)' being compiled
问题2: error C2248: '_Screen' : cannot access private member declared in class 'Screen<2,3>'
d:\programe\c++ primer\test3\screen.h(29) : see declaration of '_Screen'