检查巩膜黄染时,应在()。
A.自然光线下
B.日光灯下
C.黄炽灯下
D.电筒光下
E.强光下
参考答案:A
检查巩膜黄染时,应在()。
A.自然光线下
B.日光灯下
C.黄炽灯下
D.电筒光下
E.强光下
参考答案:A
【说明】
某绘图系统存在point、line、square三种图元,它们具有Shape接口,图元的类图关系如图13-12所示。现要将circle图元加入此绘图系统以实现功能扩充。已知某第三方库已经提供了XCircle类,且完全满足系统新增的Circle图元所需的功能,但XCircle不是由 Shape派生而来的,它提供的接口不能被系统直接使用。代码13-2既使用了XCircle又遵循了Shape规定的接口,既避免了从头开发一个新的Circle类,又可以不修改绘图系统中已经定义的接口。代码13-3根据用户指定的参数生成特定的图元实例,并对之进行显示操作。绘图系统定义的接口与XCircle提供的显示接口及其功能如表13-5所示。
表13-5接口及其功能
Shape | XCircle | 功能 |
display() | DisplayIt() | 显示图元 |
【代码13-2】
class Circle (1) {
private (2) pxc;
public Circle(){
pxc=new (3) ;
}
public void display(){
pxc. (4) ;
}
}
【代码13-3】
public class Factory{
public (5) getShape Instance(int tyoe){ //生成特定类实例
switch(type){
case 0: return new point();
case 1: return new Rectangle();
case 2: return new line();
case 3: return new Circle();
default: return null
}
}
};
public class App{
public static viod main(String argv[
){
if(argv. length!=1){
system. out. println("error parameters!");
Return;
}
int type=(new Integer(argv[0
)). intValue();
Factory factory=new Factory();
shape s;
s=factory. (6) ;
if(s==null){
system.out. println("Error get instance!");
Return;
}
s.display();
return;
}
}