课程政策与作业:邮件支持、分组及作业日期.pdfVIP

  • 0
  • 0
  • 约7.29千字
  • 约 18页
  • 2026-01-15 发布于北京
  • 举报

课程政策与作业:邮件支持、分组及作业日期.pdf

今天的公告:

课程政策:

邮件协助(ews,svn等):cs225help@cs.illinois.edu

分组在Siebel0224会议室进行。

作业0已发布,截止日期为周一上课前。

项目1已发布,截止日期为8/30,晚上11:59。

DYB(Siebel3405):

•每周二,1:30‑3:30(Cinda)

熟练考试:8/29,7‑10点,Siebel2407

linuTyTufoRaI0229SiebIe1.9.

Str类定义的结构(续):客户端代码:spheremyVar;sphere.hsphere.cpp

classsphere{public:sphere();ctorssphere(doubler);void

setRadius(doublenewRad);doublegetDiameter()const;private:

doubletheRadius;}

//构造函数(下一页)void

sphere::setRadius(double

newRad){theRadius=newRad;}double

sphere::getDiameter()const{return

2*theRadius;}

附注:

const:getDiameter对球体类的私有成员不进行修改的承诺。

:‘作用域解析运算符’将此setRadius的实现连接到sphere

构造函数(简介):

我们为

关于构造函数需要记住的几点:

Today’sannouncements:

Coursepolicies:

Emailassistance(ews,svn,etc.):cs225help@cs.illinois.edu

SectionsmeetinSiebel0224.

HW0available,dueMondaybeforelecture.

MP1available,due8/30,11:59p.

DYB(Siebel3405):

•EveryTue,1:30-3:30p(Cinda)

Proficiencyexam:8/29,7-10p,Siebel2407

linuTyTufoRaI0229SiebIe1.9.

Structureofaclassdefin(cont):clientcode:spheremyVar;sphere.hsphere.cpp

classsphere{

public:sphere();ctors

sphere(doubler);

voidsetRadius(doublenewRad);doublegetDiameter()const;

private:doubletheRadius;

//constructor(s)(nextpage)

voidsphere::setRadius(double

newRad){theRadius=newRad;

}

doublesphere::getDiameter()const{

return2*theRadius;

}

Asides:

const:apinkypromisebygetDiameterthatitwillnotchangeaprivatememberofthe

sphereclass.

:‘scoperesolutionoperator’connectsthisimplementationofsetRadiustosphere

Constructors(intro):

codethatwewriteforthe

Pointstorememberabtcctors:

*1.如果你不写任何构造函数,系统会为你写一个。2.如果你写了任何一个构造函数,系统将

不会默认的。我的s(s.2)3.构造函数不会被“调用”——它们是为系统在需

要时调用而写的。do

所以。intmain(){spherea;sphere

b(5.8);}//默认构造函数

sphere::sphe

文档评论(0)

1亿VIP精品文档

相关文档