[ create a new paste ] login | about

Link: http://codepad.org/LX3IBitd    [ raw code | output | fork ]

C++, pasted on Jun 25:
#include<iostream.h>
using namespace std;

//public <T>void getArrayLength(T[] array) 
static int getArrayLength(Object array)
{
cout<<"That array held elements"<<array.length()<<endl;
}

/* Utility function to print an array */
/* void printArray(int arr[], int size) 
{ 
   for (int i = 0; i < size; i++) 
   cout << arr[i] << " "; 
  
   cout << endl; 
} */  

int main()
{
    int[] a = {12,21,7,16,8,13};
    getArrayLength(a);
    return 0;

}


Output:
1
2
Line 5: error: 'Object' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: