对于选择排序算法的函数原型,可以写作:
A: template <;typename S, int arraySize>; void selectionSort(S list[], int arraySize) { // do something}
B: template <;typename S>; void selectionSort(S list[], int arraySize) { // do something}
C: template <;typename S, int ARRAY_SIZE>; S selectionSort(int list[]) { // do something}
D: template <;typename S>; void selectionSort(int list[], S arraySize) { // do something}
A: template <;typename S, int arraySize>; void selectionSort(S list[], int arraySize) { // do something}
B: template <;typename S>; void selectionSort(S list[], int arraySize) { // do something}
C: template <;typename S, int ARRAY_SIZE>; S selectionSort(int list[]) { // do something}
D: template <;typename S>; void selectionSort(int list[], S arraySize) { // do something}
举一反三
- 对于选择排序算法的函数原型,可以写作: A: template <;typename S>; void selectionSort(S list[], int arraySize) { // do something} B: template <;typename S>; void selectionSort(S list[], int arraySize) { // do something} C: template <;typename S, int ARRAY_SIZE>; S selectionSort(int list[]) { // do something} D: template <;typename S>; void selectionSort(int list[], S arraySize) { // do something}
- 对于选择排序算法的函数原型,可以写作: A: template <typename S, int arraySize> void selectionSort(S list[], int arraySize) { // do something} B: template <typename S> void selectionSort(S list[], int arraySize) { // do something} C: template <typename S, int ARRAY_SIZE> S selectionSort(int list[]) { // do something} D: template <typename S> void selectionSort(int list[], S arraySize) { // do something}
- 定义如下方法,下面选项中()错误的实现对该方法的重载。public static String do(int n,String s){......} A: public static int do(int num,String s){......} B: public static String do(String s,int n){......} C: public static void do(String s,int value) {......} D: public static void do(){......}
- 如果有,指出下面类模板声明(或声明对)中哪些是非法的。(a)template <class Type> class C1;template <class Type,int size> class C1;(b)template <class T,U,class V> class C2;(c)template <class C1,typename C2>class C3(};(d)template <typename myT,class myr> class C4{};(e)template <class Type,int*ptr> class C5;template <class T,int*pi>class C5;
- 有如下函数模板定义: template<typename T1,typename T2,typename T3) T2 plus(T1 t1,T3 t3){return t1+t3;} 则以下调用正确是( )。 A: plus(3,5; B: plus<>(3,5; C: plus<int>(3,5; D: plus<int,doubl(3,5;