为什么我用vs2017输出的结果不一样cout <<q->getCount<< endl,这句输出的不是12而是一个地址值
#include<iostream>
#include<stdlib.h>
#include"Tank.h"
using namespace std;
class Tank
{
public:
Tank(char code);
~Tank();
void fire();
static int getCount();
private:
static int s_iCount;
char m_cCode;
};
Tank::Tank(char code)
{
m_cCode = code;
s_iCount++;
cout << "Tank" << endl;
}
Tank::~Tank()
{
s_iCount--;
cout << "~Tank" << endl;
}
void Tank::fire()
{
cout << "Tank--fire" << endl;
}
int Tank::getCount()
{
return s_iCount;
}
int main()
{
Tank *p=new Tank('A');
cout << Tank::getCount() << endl;
Tank *q = new Tank('B');
cout <<q->getCount<< endl;
delete p;
delete q;
cout << Tank::getCount() << endl;
system("pause");
return 0;
}