问题 问答题 简答题

单件实例是什么?

答案

参考答案:

Foundation和ApplicationKit框架中的一些类只允许创建单件对象,即这些类在当前进程中的唯一实例。举例来说,NSFileManager和NSWorkspace类在使用时都是基于进程进行单件对象的实例化。当向这些类请求实例的时候,它们会向您传递单一实例的一个引用,如果该实例还不存在,则首先进行实例的分配和初始化。单件对象充当控制中心的角色,负责指引或协调类的各种服务。如果类在概念上只有一个实例(比如NSWorkspacE.,就应该产生一个单件实例,而不是多个实例;如果将来某一天可能有多个实例,您可以使用单件实例机制,而不是工厂方法或函数。

完形填空
Are you nervous when you stand in front of the public? Are you afraid to make a speech?
Li Jun, a middle school boy, felt shy when he was making a speech the other day. Li had thought it would be quite easy to speak in front of   1  classmates.
"I was wrong. It was very different and much  2  than talking to my classmates during playtime," Li said. "I tried, but it was really difficult to speak. I felt like a mute (哑巴) and wanted to leave the classroom   3  "
Li is not alone. Many middle school students now have the same   4  : they can talk about their ideas freely   5  their best friends after class, but can't speak in public. According to Zhou Hong, a teacher from a university, the main reason is that schools in China pay more attention to writing instead of  6 .
Zhou hopes schools can give students more chances to open their   7 , such as speech competitions, English corners and class discussions. Students can join in any one they want to. 8  he also gives some advice to students. "During your free time you should  9  more. When you're speaking in public, take it easy. Just imagine you're talking to nobody and speak up your ideas clearly," Zhou said. "That   10  a fine public speech and you'll feel confident. "
小题1:
A.herB.myC.yourD.his
小题2:
A.harderB.easierC.better'D.later
小题3:
A.slowlyB.quicklyC.sadlyD.happily
小题4:
A.answerB.subjectC.problemD.question
小题5:
A.exceptB.besideC.fromD.with
小题6:
A.listeningB.speakingC.readingD.singing
小题7:
A.mouthsB.eyes C.mindsD.hearts
小题8:
A.ButB.SoC.AndD.Or
小题9:
A.playB.practiceC.writeD.watch
小题10:
A.reportsB.keepsC.hearsD.makes
判断题