1.举例说明new关键字可用于哪些方面。
2.sealed关键字的作用是什么?什么情况下需要使用sealed关键字?
3.哪些关键字可用于版本控制?
====================================================
附70-315试题
You are a Web developer for Test104. Test104 has just merged with RealPass Inc. Now,you are required to perform migration of RealPass's ASP-based Web page named ProductsList.asp to ASP.NET. You want to deploy the ASP.NET version of your Web page with the minimum amount of development effort.You also want the migration th be accomplished as quickly as possible.
The page contains a COM component named Test104.ProductsList. The component is written in Microsoft Visual Basic 6.0. When you open the new page,you receive the following error message:"Server error - The component 'Test104.ProductsList' cannot be created." You need to ensure that you can open the Web page successfully. What should you do?A.Write a manage component to perform the tasks that the Test104. ProductsList component currently performs.
B.Add the following line of code to the Page. Load event handler.
C.RegisterRequiresPostBack("Test104.ProductsList")
D.Add the following attribute to the processModell element of the Web.config file: comlmpersonationLever=Delegate
E.Set the AspCompat attribute of the Page directive to true.
2.sealed关键字的作用是什么?什么情况下需要使用sealed关键字?
3.哪些关键字可用于版本控制?
====================================================
附70-315试题
You are a Web developer for Test104. Test104 has just merged with RealPass Inc. Now,you are required to perform migration of RealPass's ASP-based Web page named ProductsList.asp to ASP.NET. You want to deploy the ASP.NET version of your Web page with the minimum amount of development effort.You also want the migration th be accomplished as quickly as possible.
The page contains a COM component named Test104.ProductsList. The component is written in Microsoft Visual Basic 6.0. When you open the new page,you receive the following error message:"Server error - The component 'Test104.ProductsList' cannot be created." You need to ensure that you can open the Web page successfully. What should you do?A.Write a manage component to perform the tasks that the Test104. ProductsList component currently performs.
B.Add the following line of code to the Page. Load event handler.
C.RegisterRequiresPostBack("Test104.ProductsList")
D.Add the following attribute to the processModell element of the Web.config file: comlmpersonationLever=Delegate
E.Set the AspCompat attribute of the Page directive to true.
2、sealed-防止被继承,没用过
3、不清楚
Server error - The component 'Test104.ProductsList' cannot be created.(这个就不要我翻译了吧)
身为高手的你必须搞定这个错误!那么你该怎么做呢?
(译者注:靠,这次怎么选项也要翻译)
A、重写一个托管的组件来实现Test104.ProductsList的功能;
B、在页面里添加下面这行代码,(译者注:代码在哪啊?)加载事件处理程序;
C、RegisterRequiresPostBack("Test104.ProductsList")
D、在web.config中为processModel元素增加这个属性:comlmpersonationLever=Delegate
E、把页面的AspCompat属性设为true这次的我就不会了,因为我在.net下面用过com的地图控件,问题多多,自己也解决不了,如果逼我,我宁愿选A :P
1.举例说明new关键字可用于哪些方面。
答:在C#中,new关键字可用作运算符或修饰符。作为运算符,用于在堆上创建对象和调用构造函数;作为修饰符,用于隐藏基类成员的继承成员。
2.sealed关键字的作用是什么?什么情况下需要使用sealed关键字?
答:在类声明中使用sealed修饰符可防止其它类继承此类。在方法声明中使用sealed修饰符可防止扩充类重写此方法。
sealed修饰符主要用于防止非有意的派生,另外它还能促使某些运行时的优化。具体说来,由于密封类永远不会有任何派生类,所以对密封类实例的虚拟函数成员的调用可以转换为非虚拟调用来处理。
3.哪些关键字可用于版本控制?
答:override关键字和new关键字均可用于版本控制。
在C#中,默认情况下方法不是虚拟的。若要使方法称为虚拟方法,必须在基类的方法声明中使用virtual修饰符。然后,派生类可以使用override关键字重写基类中的虚拟方法,或使用new关键字隐藏基类中的虚拟方法。如果override关键字和new关键字均未指定,编译器将发出警告,并且派生类中的方法将隐藏基类中的方法。
If the older file contains calls to COM components -for example,ADO code then we must add the AspCompat attribute to the page directive in HTML view. The aspcompat attribute forces the page to execute in single-threaded(STA)mode.