编辑代码

#include <iostream>
using namespace std;
class Person{
    friend ostream& operator<<(ostream& cout,Person& p1);
public:
    Person(){};
    Person(int a,int b):m_A(a),m_B(b){};
    

private:
    int m_A;
    int m_B;
};
ostream& operator<<(ostream& cout,Person& p1){
        cout<<"m_A:"<<p1.m_A<<" m_B:"<<p1.m_B;
        return cout;
    }


void test01(){
    Person p1(10,10);
    cout<<p1<<endl;
}
int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
	//cout << "Hello JSRUN!   \n\n         - from C++ ." << endl;
    test01();
	return 0;
}