specialdate.h

来自「C++参考书」· C头文件 代码 · 共 42 行

H
42
字号

#ifndef SPECIALDATE_H
#define SPECIALDATE_H
#include "date.h"

class SpecialDate : public Date
{
	public:
		SpecialDate( int d, int m, int y ) : Date( m, d, y ) { }

		virtual void display( void ) const ;

		bool isNullDate( void ) const
		{ return ndays == 0 ; }

	private:
		static char *mos[] ;
} ;

char* SpecialDate::mos[] = {
	"January",
	"February",
	"March",
	"April",
	"May",
	"June",
	"July",
	"August",
	"September",
	"October",
	"November",
	"December"
} ;

void SpecialDate::display( void ) const
{
	if ( !isNullDate() )
		cout << mos[getMonth() - 1] << ' ' << getDay() << ", " << getYear() << endl ;
}

#endif

⌨️ 快捷键说明

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