我有这个小R脚本
#ifndef TRASHCAN_H
#define TRASHCAN_H
#include <iostream>
using namespace std;
class TrashCan {
public:
TrashCan( );
TrashCan( int size );
TrashCan( int size, int contents, int empty );
void setSize( int size );
int getSize( );
int getContents( );
void addItem( );
void empties( );
void cover( );
void uncover( );
friend TrashCan operator + ( const TrashCan& yourCan, const TrashCan& myCan ); /*as the assignment asks... I override the +,-, and <,> operators. */
friend TrashCan operator - ( const TrashCan& combined, const TrashCan& myCan); /*I have used the bool statements for the <,> to compare sizes */
friend bool operator > ( const TrashCan& myCan, const TrashCan& yourCan);
friend bool operator < ( const TrashCan& myCan, const TrashCan& yourCan );
friend ostream& operator<< (ostream &out, TrashCan& myCan);
void printCan( );
private:
bool myIsCovered;
int my_Size;
int my_Contents;
int my_Empty;
};
#endif
线条的宽度有一些重要意义,我想在图例中反映这一点,但我希望有垂直线而不是水平线。
你有什么想法,小图片显示了我想要的东西,我只是为了演示目的改变了符号的颜色: - )