⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sortable.h

📁 hello everybody. good lucky to you
💻 H
字号:
/*------------------------------------------------------------------------*/
/*                                                                        */
/*  SORTABLE.H                                                            */
/*                                                                        */
/*  Copyright Borland International 1991                                  */
/*  All Rights Reserved                                                   */
/*                                                                        */
/*------------------------------------------------------------------------*/

#if !defined( _SORTABLE_H )
#define _SORTABLE_H

#if !defined( __CLSDEFS_H )
#include <ClsDefs.h>
#endif  // __CLSDEFS_H

#if !defined( __OBJECT_H )
#include <Object.h>
#endif  // __OBJECT_H

_CLASSDEF(ostream)
_CLASSDEF(Sortable)

class _CLASSTYPE Sortable : public Object
{

public:

    virtual int isEqual( const Object _FAR & ) const = 0;
    virtual int isLessThan( const Object _FAR & ) const = 0;
    virtual int isSortable() const
        {
        return 1;
        }

    virtual classType isA() const = 0;
    virtual char _FAR *nameOf() const = 0;
    virtual hashValueType hashValue() const = 0;
    virtual void printOn( ostream& ) const = 0;

};


inline
int operator < ( const Sortable _FAR & test1, const Sortable _FAR & test2 )
{
    return ( (test1.isA() == test2.isA()) && test1.isLessThan( test2 ) );
}

inline
int operator > ( const Sortable _FAR & test1, const Sortable _FAR & test2 )
{
    return !( test1 < test2 ) && test1 != test2;
}

inline
int operator >=( const Sortable _FAR & test1, const Sortable _FAR & test2 )
{
    return ( !( test1 <( test2 ) ) );
}

inline
int operator <=( const Sortable _FAR & test1, const Sortable _FAR & test2 )
{
    return ( test1 < test2 || test1 == test2 );
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -