49 - this

2018-01-02  本文已影响0人  社交帐号直接注册
#include <iostream>
#include "Hannah.h"
using namespace std;

int main()
{
    Hannah ho(23);
    ho.printCrap();
    system("pause");
}

#ifndef HANNAH_H
#define HANNAH_H

class Hannah
{
public:
    Hannah(int);
    void printCrap();
private:
    int h;
};

#endif

#include <iostream>
#include "Hannah.h"
using namespace std;

Hannah::Hannah(int num):h(num)
{

}

void Hannah::printCrap()
{
    cout << "h=" << h << endl;
    cout << "this->h" << this->h << endl;
    cout << "(*this).h=" << (*this).h << endl;
}
上一篇 下一篇

猜你喜欢

热点阅读