c++,左移运算符重载

c++,左移运算符重载,第1张

此为学习c++,笔记。

#include
#include
using namespace std;
#include
#include
class Person
{
    friend ostream &operator<<(ostream &cout,Person &p);
public:
    Person(int a,int b)
    {
        m_a=a;
        m_b=b;
    }
private:

    int m_a;
    int m_b;
};
ostream &operator<<(ostream &cout,Person &p)
{
    cout<     return cout;
}
void test01()
{
    Person p(10,10);
    //p.m_a=10;
   // p.m_b=10;
    cout< }
int main()
{
    test01();
    system("pause");
    return 0;
}

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/662364.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-18
下一篇2022-04-18

发表评论

登录后才能评论

评论列表(0条)

    保存