TAILIEUCHUNG - Professional ASP.NET 1.0 Special Edition- P4
Professional Special Edition- P4:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | In C there is no direct distinction between a Sub and a Function and members are just implemented as functions that may or may not return data . The syntax is public protected internal protected internal private static virtual override abstract extern type void memberName parameters The various keywords are described below Keyword Description public The member is publicly accessible. protected The member is only accessible from the containing class or types derived from the containing member. internal The member is only accessible from this program. Equivalent to Friend in Visual Basic. Table continued on following page Keyword Description protected internal The member is only accessible from this program or types derived from the containing member. Equivalent to Protected Friend in Visual Basic. private The member is only accessible from within the containing member. static The member is shared by all instances of the class and exists independently of a class instance. Equivalent to Shared in Visual Basic. virtual The member can be overridden by a sub-class. override The member overrides an identically named member from a base class with the same signature. The base class member must be defined as virtual abstract or override. abstract This member is an abstract member and must be implemented by a sub-class. extern The member is implemented in an external assembly. For example public class calculator public double Add double opl double op2 return opl op2 For a method that does not return a result we declare the type as void public void updateSomething Properties Properties in C are very similar to Visual Basic .NET and can be implemented as public member variables or by using the property accessors. For example the following uses public variables public class calculator public double Opl public double Op2 public double Add return Opi Op2 The alternative and preferred approach is to use property accessors. For example public class calculator private double _op1 .
đang nạp các trang xem trước