3.13. Summary

 < Day Day Up > 

The goal of the C# language architects was to create a "component-oriented" language based on the traditional object-oriented principles of encapsulation, inheritance, and polymorphism. Toward this end, they included language features that make properties, events, and attributes first-class language constructs. Properties now have their own get and set syntax; events can be created with the event keyword and linked to delegates that call registered methods when the event occurs; custom or built-in attributes can be attached to a class or selected class members to add descriptive information to an assembly's metacode.

C# provides several forms of method declarations: a virtual method permits a derived class to implement its own version of the method; sealed prevents a derived class from overriding it; and abstract requires a derived class to implement its own version of the method.

In some cases, a structure or interface provides a better programming solution than a class. The C# struct is an efficient, simple way to represent self-contained data types that don't require the overhead of classes. An interface is a practical way to define a behavior that can be passed on to inheriting classes. In .NET, its value is enhanced because a class (or struct) can inherit from any number of interfaces but from only one class.

     < Day Day Up > 

    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net