what is wrong with the code below,
when i compile i get the following error:
ld:
Unresolved:
myClass::myArra y
but when i dont use the keyword static while declaring the array,
there is no problem. what is the story about static arrays in class
*************** ********
when i compile i get the following error:
ld:
Unresolved:
myClass::myArra y
but when i dont use the keyword static while declaring the array,
there is no problem. what is the story about static arrays in class
*************** ********
Code:
#include <iostream> using namespace std; class myClass{ private: int a; static int myArray[10]; public: myClass(); void display(); }; int main() { myClass A; A.display(); return 0; } myClass::myClass() { for(int i=0; i<10; i++) myArray[i]=i; } void myClass::display() { for(int i=0; i<10; i++) cout<<myArray[i]<<" "; cout<<endl; } *****************************
Comment