012 这个指针哪来的

#include <iostream>
using namespace std;

struct A
{
	int v;
	A(int vv):v(vv) { }
const A * getPointer() const {
        return this;
    }
};

int main()
{
	const A a(10);
	const A * p = a.getPointer();
	cout << p->v << endl;
	return 0;
}
posted @ 2022-02-19 22:44  icefield817  阅读(32)  评论(0编辑  收藏  举报