?? head.h
字號:
#ifndef STRING1_H
#define STRING1_H
#include <iostream>
//using namespace std;
using std::ostream;
using std::istream;
class String {
friend ostream &operator<<( ostream &, const String & );
friend istream &operator>>( istream &, String & );
public:
String(const char * = "" );
String(const String & );
~String();
const String &operator=( const String & );
const String &operator+=( const String & );
bool operator!() const;
bool operator==( const String & ) const;
bool operator<(const String & ) const;
//test s1 != s2
bool operator!=( const String & right ) const
{
return !( *this == right );
}
//test s1>s2
bool operator>( const String &right ) const
{
return right < *this;
}
//test s1<=s2
bool operator<=(const String &right ) const
{
return !(right < *this );
}
//test s1>=s2
bool operator>=( const String &right ) const
{
return !(*this < right );
}
//end function operator
char &operator[]( int );
const char &operator[]( int ) const;
String operator()( int, int );
int getLenth() const;
private:
int length;
char *sPtr;
void setString( const char * );
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -