Find the error..

Sep 13, 2014 at 3:09pm
The definition of the class AA got some error. Can anyone let me know whats the error in Class AA? The output should be same as in comments below..


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  
class AA {
 int x;
public :
int getX() {
 return x;
}
};

int main () {
 cout << AA :: getX() << endl; // 0
AA* a = new AA[100];
cout << AA :: getX() << endl; //100
delete [] a;
cout << AA:: getX() << endl; // 0
Sep 13, 2014 at 3:27pm
closed account (48T7M4Gy)
try '#include <iostream>', then maybe 'std' etc
Sep 13, 2014 at 3:38pm
Error 1: To call function as AA::getX(), it should be static.

Error 2: There is no code which would calculate amount of created objects
Topic archived. No new replies allowed.