正在加载图片...
上海交通大学交大密西根 联合学院· 81 UM-SJTU Joint Institute University of Michigan Shanghal Jiao Tong University Declare a vector A vector is a class template.Templates let us write a single class or function definition that can be used on a variety of types. ● To declare objects from a class template,we must supply additional information.In the case of vector,we must say what type of objects the vector will contain: vector<int>intVector(MAX_ELE_NUM); vector<LineT>lineVector(100);Declare a Vector Declare a Vector • A vector is a class template. Templates let us write a single class or function definition that can be used on a variety of types. • To declare objects from a class template, we must supply additional information. In the case of vector, we must say what type of objects the vector will contain: vector<int> intVector (MAX_ELE_NUM); vector<LineT> lineVector (100);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有