http://blog.csdn.net/lovecady/article/details/2562026 當添加程式集引用時,可能會造成某種類型衝突,即你的應用程式在另一個程式集中定義的一個類型有相同的命名,那麼你就要為引用添加別名。當你為程式集添加別名時,在該程式集中使用過的命名空間將在別名下,而不是在global下被解析。要在一個程式集添加別名,首先在Visual Studio 2005中添加程式集的引用,然後,在解決方案管理器中開啟“引用”檔案夾,顯示引用的程式集屬性。還需要修改代碼:[
Sealed classes are used to restrict the inheritance feature of object oriented programming. Once a class is defined as sealed class, this class cannot be inherited. In C#, the sealed modifier is used to define a class as sealed. In Visual Basic
三、虛方法 當類中的方法聲明前加上了virtual 修飾符,我們稱之為虛方法,反之為非虛。使用了virtual 修飾符後,不允許再有static, abstract, 或override 修飾符。 樣本1:帶有虛方法的類 using System ; public class DrawingBase { public virtual void Draw( ) { Console.WriteLine("這是一個虛方法!") ; }
繼續上一節的問題:調換兩個新建立的線程啟動順序會是什麼結果?using System; using System.Threading; namespace Test { class TestThread { private static void FirstThreadFun() { for (int i = 0; i < 10; i++) {
關於異常,記錄一些看到的和自己總結的for (int i = 0; i <= 2; i++){ try { int number = Convert.ToInt32("aa"); } catch (Exception ex) { throw new MyUserException(ex.Message);
C++ UI frameworkNameplatformDescriptionMFCwindowshttp://en.wikipedia.org/wiki/Microsoft_Foundation_Classes WTLwindowshttp://en.wikipedia.org/wiki/Windows_Template_Library OwlWindowsoutdatedvclWindowsOutdated, cannot used by
#include <stdio.h>class SomeClass { public: void some_member_func(int x, char *p) { printf("In SomeClass"); };};class DerivedClass : public SomeClass { public: // If you uncomment the next line, the code at line (*) will fail!//