Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
the underlying TextWriter for the output device is created. But if the application makes no reference to the In and Error properties, then no objects are created for those devices. 10.6.3 Virtual, override, and ab stract accessors Provided a property is not static, a property declaration may include a virtual modifier or an abstract modifier on either or both of its accessors. There is no requirement that the modifiers be the same for each accessor | Chapter 10 Classes public static Textwriter Error get if error null error new StreamWriter File.OpenStandardError return error The Console class contains three properties In Out and Error that represent the standard input output and error devices. By exposing these members as properties the Console class can delay their initialization until they are actually used. For example upon first referencing the Out property as in Console.Out.WriteLine Hello world the underlying TextWriter for the output device is created. But if the application makes no reference to the In and Error properties then no objects are created for those devices. 10.6.3 Virtual override and abstract accessors Provided a property is not static a property declaration may include a virtual modifier or an abstract modifier on either or both of its accessors. There is no requirement that the modifiers be the same for each accessor. For example it is possible for a property to have a non-virtual get accessor and a virtual set accessor. The virtual accessors of an inherited property can be overridden in a derived class by including a property declaration that specifies override directives on its accessors. This is known as an overriding property declaration. An overriding property declaration does not declare a new property. Instead it simply specializes the implementations of the virtual accessors of an existing property. It is an error to mix override and non-override accessors in a property declaration. If a property declaration includes both accessors then both must include an override directive or both must omit it. An overriding property declaration must specify the exact same access modifiers type and name as the inherited property and it can override only those inherited accessors that are virtual. For example if an inherited property has a non-virtual get accessor and a virtual set accessor then an overriding property declaration can only include an override set accessor. When both accessors of