正在加载图片...
∥/测试函数 int maino Any Type <int> i(1, 2); Any Type <double> d(1.5, 2.7); Any Type <char>c(a,b); Any Type <char*> s(" Hello"template class"); cout<<"整型类:"<< i GetX0<<""<< i GetTo<<end; cout<<"双精度类:"<<dGeX0<<","<< d GetY0<< endl. cout<<"字符类:"<< C GetX0<<","<< C GetY0<<end; cout<<"字符串类:"<< s Getx0<<","<< s Gety0<<endl; return o: 0 2018, SEU. All rights reserved. 23© 2009, SEU. All rights reserved. © 2018, SEU. All rights reserved. 23 // 测试函数 int main() { AnyType <int> i (1, 2); AnyType <double> d (1.5, 2.7); AnyType <char> c ('a', 'b'); AnyType <char *> s ("Hello", "template class"); cout << "整型类:" << i.GetX() << ", " << i.GetY() << endl; cout << "双精度类:" << d.GetX() << ", " << d.GetY() << endl; cout << "字符类:" << c.GetX() << ", " << c.GetY() << endl; cout << "字符串类:" << s.GetX() << ", " << s.GetY() << endl; return 0; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有