the managed C++ code:
浅析我国农村生态环境现状的研究 class MyClass
{
defines a plain C++ class, whereas the code:
__gc class MyClass
{
will give you a managed class, just as if you’d written the class in C# or Visual Basic .NET. The advantage
of using managed C++ over C# code is that we can call unmanaged C++ classes from managed C++
code without having to resort to COM interop.
The compiler raises an error if you attempt to use features that are not supported by .NET on managed
types (for example, templates or multiple inheritance of classes). You will also find that you will need to
use nonstandard C++ features (such as the __gc keyword shown in the previous code) when using
managed classes.
Because of the freedom that C++ allows in terms of low-level pointer manipulation and so on, the C++
compiler is not able to generate code that will pass the CLR’s memory type safety tests. If it’s important
that your code is recognized by the CLR as memory type safe, then you’ll need to write your source code
in some other language (such as C# or Visual Basic .NET).
Visual J# .NET
The latest language to be added to the mix is Visual J# .NET. Prior to .NET Framework 1.1, users were
able to use J# only after making a separate download. Now the J# language is built into the .NET
Framework. Because of this, J# users are able to take advantage of all the usual features of Visual Studio
.NET. Microsoft expects that most J++ users will find it easiest to use J# if they want to work with .NET.
Instead of being targeted at the Java runtime libraries, J# uses the same base class libraries that the rest
of the .NET compliant languages use. This means that you can use J# for building ASP.NET Web applications,
Windows Forms, XMLWeb services, and everything else that is possible—just as C# and Visual
Basic .NET can.本文来自优.文,论-文·网原文请找腾讯752018766
Scripting languages
Scripting languages are still around, although, in general, their importance is likely to decline with the
advent of .NET. JScript, on the other hand, has been upgraded to JScript .NET. We can now write ASP.NET
pages in JScript .NET, run JScript .NET as a compiled rather than an interpreted language, and write
strongly typed JScript .NET code. With ASP.NET there is no reason to use scripting languages in serverside
Web pages. VBA is, however, still used as a language for Microsoft Office and Visual Studio macros.
COM and COM+
Technically speaking, COM and COM+ aren’t technologies targeted at .NET, because components based
on them cannot be compiled into IL (although it’s possible to do so to some degree using managed C++, if
the original COM component was written in C++). However, COM+ remains an important tool, because
its features are not duplicated in .NET. Also, COM components will still work—and .NET incorporates
COM interoperability features that make it possible for managed code to call up COM components and
vice versa (this is discussed in Chapter 29). In general, however, you will probably find it more convenient
for most purposes to code new components as .NET components, so that you can take advantage of the
.NET base classes as well as the other benefits of running as managed code.
上一页 [1] [2] [3] 下一页
计算机英文文献托管代码的优点翻译 第2页下载如图片无法显示或论文不完整,请联系qq752018766