试题详情
- 单项选择题You work as an application developer at Certkiller .com. You are currently in the process of creating a class that stores data about Certkiller .com’s customers. Certkiller .com customers are assigned unique identifiers and various characteristics that may include aliases, shipping instructions, and sales comments. These characteristics can change in both size and data type. You start by defining the Customer class as shown below: public class Customer { private int custID; private ArrayList attributes; public int CustomerID { get {return custID;} } public Customer (int CustomerID) { this.custID = CustomerID; this.attributes = new ArrayList (); } public void AddAttribute (object att) { attributes.Add (att); } } You have to create the FindAttribute method for locating attributes in Customer objects no matter what the data type is.You need to ensure that the FindAttributemethod returns the attribute if found,and you also need to ensure type-safety when returning the attribute.What should you do?()
A、 Use the following code to declare the FindAttribute method: public T FindAttribute (T att) {//Find attribute and return the value }
B、 Use the following code to declare the FindAttribute method: public object FindAttribute (object att) {//Find attribute and return the value }
C、 Use the following code to declare the FindAttribute method: public T FindAttribute
(T att) {//Find attribute and return the value } D、 Use the following code to declare the FindAttribute method: public string FindAttribute (string att) {//Find attribute and return the value }
- C
关注下方微信公众号,在线模考后查看
热门试题