operator< 小于符号运算符重载问题,输出结果总是反的是什么原因呢?

输出结果总是是1234,如果想输出1321 samsung message send,应该怎么改动啊,
只改动这一部分的代码


Mobile::Mobile(){}

Mobile::Mobile(char *t,int c, int n):Telephone(n)
{
    strcpy(type,t);
    cost = c;    
}

int operator<(Mobile &x1, Mobile &x2)
{
    if(x1.number < x2. number) return x2.number;
    else return x1.number;
}

源程序如下:


/*程序运行结果为:
1321    samsung message send*/

#include<string.h>
//StudybarCommentBegin
#include<iostream>
using namespace std;
//#include <iostream.h>
class Telephone
{
protected :
    int number;
public:
    Telephone()
    {number=1234;}
    Telephone(int n)
    {number=n;}
    void showNumber()
    {cout<<"my phone number is: "<<number<<endl;}
    void call()
    {cout<<"the phone is calling \n";}
};
class Mobile:public Telephone
{
    char *type = new char[20];
    int cost;
public:
    Mobile();
    Mobile(char *t,int c, int n);   //n-tel,c-cost,t-type 
    void message()
    {
        cout<<number<<"\t"<<type<<"\tmessage send\n ";
    }
    friend int operator<(Mobile &x1,Mobile &x2);
};

//StudybarCommentEnd


Mobile::Mobile(){}

Mobile::Mobile(char *t,int c, int n):Telephone(n)
{
    strcpy(type,t);
    cost = c;    
}

int operator<(Mobile &x1, Mobile &x2)
{
    if(x1.number < x2. number) return x2.number;
    else return x1.number;
}

//StudybarCommentBegin
int main()
{
    Mobile m1;
    Mobile m2("samsung",3500,1321);
    if(m1<m2)
        m1.message();
    else
        m2.message();
}    

//StudybarCommentEnd

重载函数需要返回True和False,而不是实际数值,否则if条件一直为True只会执行m1.message(),修改如下:

int operator<(Mobile &x1, Mobile &x2)
{
    if(x1.number < x2. number) return 0;
    else return 1;
}