题目内容

阅读下列说明和C++代码,将应填入(n)处的字句写在对应栏内。
【说明】
已知某类库开发商提供了一套类库,类库中定义了Application类和Document类,它们之间的关系如下图所示。其中,Application类表示应用程序自身,而Document类则表示应用程序打开的文档。Application类负责打开一个已有的以外部形式存储的文档,如一个文件,一旦从该文件中读出信息后,它就由一个Document对象表示。
当开发一个具体的应用程序时,开发者需要分别创建自己的Application和Document子类,例如上图中的类MyApplication和类MyDocument,并分别实现Application和 Document类中的某些方法。
已知Application类中的openDocument方法采用了模板方法(Template Method)设计模式,该方法定义了打开文档的每一个主要步骤,如下所示:
1.首先检查文档是否能够被打开,若不能打开,则给出出错信息并返回;
2.创建文档对象;
3.通过文档对象打开文档;
4.通过文档对象读取文档信息;
5.将文档对象加入到Application的文档对象集合中。
【C++代码】
include<iostream>
include<vector>
using namespace std;
class Document{
public:
void save(){/*存储文档数据,此处代码省略*/)
void open(string docName){ /*打开文档,此处代码省略*/)
void close(){ /*关闭文档,此处代码省略*/)
virtual void read(string docName) =0;
};
class Appplication{
private:
vector<(1)> docs; /*文档对象集合*/
public:
bool canOpenDocument(string docName){
/*判断是否可以打开指定文档,返回真值时表示可以打开,
返回假值表示不可打开,此处代码省略*/
}
void addDocument(Document * aDocument){
/*将文档对象添加到文档对象集合中*/
docs.push_back((2));
}
virtual Document * doCreateDocument()=0;/*创建一个文档对象*/
void openDocument(string docName){/*打开文档*/
if ((3)){
cout<<“文档无法打开!”<<endl;
return;
}
(4) adoc=(5);
(6);
(7);
(8);
}
};

查看答案
更多问题

Trouble in Paradise Valley
A On one side of the argument there are eagles, wolves and orchids; on the other side there are endless heavy lorries and burgeoning economic growth. Welcome to Europe's new environmental battleground The conflict is coming to a head for the first time in a pristine valley in north-east Poland, crammed with spectacular wildlife, which has been earmarked as the route for a badly-needed motorway to the Baltic states. The clash of priorities has bitterly divided public opinion in Poland itself and has now set the country on collision course with the European Union. Yet the struggle to save the Rospuda valley is only the first of many conflicts likely to arise between economic development in the new EU member nations of central and eastern Europe, and their wildlife heritage.
B Species which have long been rare or extinct in western European countries, such as lynx, elk, wolf and beaver, along with scores of uncommon bird species, from eagles to corncrakes, still have substantial populations in the ten central and eastern European nations which have recently joined the EU. In Poland and the other member states which joined in 2004 (the Creek Republic, Slovakia, Slovenia, Hungary and the three Baltic countries of Estonia, Latvia and Lithuania), as well as in Bulgaria and Romania, which joined this year, two remarkable habitats in particular act as giant wildlife reservoirs for Europe as a whole. One is the vast extent of ancient forests, some of which are still primeval—meaning they have never been cut down and replanted—and the other is the great range of wetlands in river valleys, flood plains and deltas.
C The Rospuda valley combines both. The Rospuda river flows through the ancient Augastow Forest near Poland's border with Lithuania, one of the mast pristine forest regions in all of Europe; and the river's course is bracketed by a peat bog wkieh is astonishingly rich in mammals, rare birds, plants and insects. In environmental terms, the valley is a jewel Yet it sits squarely astride the route for one of Europe's most ambitious road schemes, the so-called Vm Baltica expressway from Warsaw to Heisinki, which will pass through the Baltic states. The section of the new road which is intended to be the bypass for the small town of Augustow, where two routes from Warsaw join, is planned to go right through the valley's heart.
D Environmentalists contend that the road will irreparably damage the valley, and insist an alternative route, further to the west, must be used; the Polish government, riding a wave of new prosperity with annual economic growth running at six per cent, and desperate to upgrade its transport links with its neighbours as quickly as possible, insists that the Rospuda route is the right one, wildlife or no wildlife. The people of Augustow, who are sick of the unending procession of heavy lorries through their town, heartily agree.
E A survey carried out by the Polish Bird Protection Society, Otop, has found that within 750 metres each side of the centreline of the proposed expressway as it passes through the valley, no fewer than 20 species of birds are breeding which are specifically protected, as rare or threatened, under European law. They represent a British birdwatcher's dream, ranging from the white-tailed, short-toed and lesser-spotted eagles, through the black grouse and the capercaillie, to the corncrake, the crane and the great snipe. There is much more. Among a profusion of rare wildflowers, there are 20 orchid species in the valley, including the last colony in Poland of the musk orchid Herminium monorchls, and mammals which are resident or pass through the forest and the marsh include lynx, wolf, elk, wild boar, otter and beaver.
F The Polish centre-left national daily newspaper, Gazeta Wyborcza, has taken up the cause of saving Rospuda, and has given away green lapel ribbons for supporters to wear. An electronic peti

Sales remained steady for most of the two-year period despite a sudden fall at the end of

The writer thinks that using humour is not always a good idea.

听力原文: The Larsen B ice shelf covered more than 3,000 square kilometers and was 200 metres thick until its northern part disintegrated in the 1990s. Three years ago, the central part also broke up.
An international team of researchers used data collected from six sediment cores near the former ice shelf to show the shelf had been relatively intact for at least 10,000 years or since the last ice age.
The collapse therefore goes beyond what would be expected naturally at the time. Rather, the demise is likely the result of long-term thinning due to melting from underneath, as well as short-term surface melting from global climate change, the researchers suggest.
Then in five years, the shelf shrunk by 5,700 square kilometres, say scientists who found the break up caused changes in currents and species in the area.
"As the ice shelves are disintegrating, the glaciers that are feeding them from the land are surging forward," said Robert Gilbert, a geography professor at Queen's University in Kingston, Ont.
Glaciers are no longer being held back from the ice shelf, and are pushing icebergs into the sea, said Gilbert, one of the co-authors of the study in Thursday's issue of the journal Nature.
As the glaciers melt, global sea levels could change more than predicted, he said. Flooding could result in low-lying areas.
Scientists are now watching to see if the most southern part of the Larsen ice shelf, the coldest part of Antarctica. is going to break up.
The Larsen B ice shelf covered more than 3,000 square kilometers and was (36) meters thick until its northern part (37) in the 1990s. Three years ago, the central part also broke up.
An international team of researchers used data collected from six (38) near the former ice shelf to show the shelf had been (39) for at least (40) years or since the last ice age.
The (41) therefore goes beyond what would be expected naturally at the time. Rather, the (42) is likely the result of (43) due to melting from underneath, as well as short-term (44) from global climate change, the researchers suggest.
Then in five years, the shelf shrunk by (45) square kilometers, say scientists who found the break up caused changes in (46) in the area.
"As the ice shelves are disintegrating, the (47) that are feeding them from the land are (48) ," said Robert Gilbert, a (49) at Queen's University in Kingston, Ont.
Glaciers are no longer being held back from the ice shelf, and are pushing (50) into the sea, said Gilbert, one of the co-authors of the study in (51) of the Journal Nature.
As the glaciers melt, global sea levels could change more than (52) , he said. Flooding could result in (53) .
Scientists are now watching to see if the (54) of the Larsen ice shelf, the coldest part of (55) , is going to break up.
(36)

答案查题题库