-> The understanding of and. (one sentence)

Just know how to use it, no need to understand deeplyobject(The object is girlFriend )
Two access methods:
Object.Member Object pointer- > Member Look at the operation, it is very simple:

#include<iostream>
#include<string>
using namespace std;

class MM
{
    
    
public:
	string name;
	int age;
};

int main() 
{
    
    
	MM girlFriend;
	girlFriend.name = "刘亦菲";

	MM* p = &girlFriend;
	p->age = 18;

	cout << "名字:" << p->name
		<< "\t芳龄:" << p->age;
	return 0;
}

Guess you like

Origin blog.csdn.net/m0_73344394/article/details/130389598