Person: 60 .
第1题:
某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。
A.year=1976
B.birthday. year=1976
C.person. year=1976
D.person. birthday. year=1976
第2题:
Person类可能的拷贝构造函数格式为:
A.Person(){}
B.Person(Person *p){}
C.Person(Person &p){}
D.Person(Person p){}
第3题:
【计算题】(6-9)定义Person类(属性有姓名,年龄),完成如下任务: (1)在Test类中定义方法Boolean contains(Person[]per,Person temp),该方法判断Person数组是否有Person对象temp,如果数组中存在与per相同的Person对象返回boolean; (2)定义showPerson(Person[] per)输出Person对象数组所有元素; (3)对上面定义的方法进行测试。
第4题:
2、编写一个Person类, 实现比较两个Person的年龄是否相同的方法
第5题:
【多选题】下面()是Person类的构造方法。
A.private Person(){ }
B.Person(String name,int age){ }
C.person(String name,int age){ }
D.public Person(String name,int age,char sex){ }
E.public void Person(String name,int age,char sex){ }