| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 474 人关注过本帖
标题:自制性测试中的问题
只看楼主 加入收藏
tobyliying
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2007-4-16
收藏
 问题点数:0 回复次数:0 
自制性测试中的问题

 我在学习 自制性测试中 有些问题不懂希望 大家给我讲解一下。

#ifndef DATE1_H
#define DATE1_H
#include <string>
class Date{
public:
struct Duration{
int years;
int months;
int days;
Duration(int y,int m,int d):years(y),months(m),days(d){}

};
Date();
Date(int year,int month,int day);
Date(const std::string&);
int getYear()const; // 为什么这里我调用他时,他有返回值他的返回值是从哪来的呢。
int getMonth()const;
int getDay()const;
std::string toString()const;
friend bool operation<(const Date&,const Date&); //这里的作用是什么
friend bool operation<=(const Date&,const Date&);
friend bool operation>(const Date&,const Date&);
friend bool operation>=(const Date&,const Date&);
friend bool operation==(const Date&,const Date&);
friend bool operation!=(const Date&,const Date&);
friend Duration duration(const Date&,const Date&); //这里的作用是什么
};
#endif

 在main中
Date mybday(1999,9,9);
Date d2(2003,7,4);
Date::Duration dur = duration (mybday,d2); //这里的是什么作用
test(dur.years==51);         
test(dur.months==9);
test(dur.days==3);



 

搜索更多相关主题的帖子: int Date Duration const string 
2007-06-21 10:31
快速回复:自制性测试中的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.010840 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved