正在加载图片...
例:定义一个任意类类型 AnyType #include <iostream> using namespace std template <typename T> class Any lype I TX, y: public AnyType (T a, T b): x(a), y(b)t T GetXoireturn xl T GetYofreturn y: 0 2018, SEU. All rights reserved. 22© 2009, SEU. All rights reserved. © 2018, SEU. All rights reserved. 22 例: 定义一个任意类类型AnyType #include <iostream> using namespace std; template <typename T> class AnyType { T x, y; public: AnyType(T a, T b): x(a), y(b){} T GetX(){return x;} T GetY(){return y;} };
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有