378 Object-Oriented Programming: Inheritance Chapter (Net web server) 9 alternative is
378 Object-Oriented Programming: Inheritance Chapter 9 alternative is to create fewer classes, in which each provides more substantial functionality, but such classes might provide too much functionality. Performance Tip 9.2 If classes produced through inheritance are larger than they need to be (i.e., contain too much functionality), memory and processing resources might be wasted. Inherit from the class whose functionality is closest to what is needed. Reading derived-class definitions can be confusing, because inherited members are not shown physically in the derived class, but nevertheless are present in the derived classes. A similar problem exists when documenting derived class members. In this chapter, we introduced inheritance the ability to create classes by absorbing an existing class s data members and behaviors and embellishing these with new capabilities. In Chapter 10, we build upon our discussion of inheritance by introducing polymorphism an object-oriented technique that enables us to write programs that handle, in a more general manner, a wide variety of classes related by inheritance. After studying Chapter 10, you will be familiar with encapsulation, inheritance and polymorphism the most crucial aspects of object-oriented programming. SUMMARY Software reusability reduces program-development time. The direct base class of a derived class is the base class from which the derived class inherits [via the colon (:) symbol]. An indirect base class of a derived class is two or more levels up the class hierarchy from that derived class. With single inheritance, a class is derived from one base class. C# does not support multiple inheritance (i.e., deriving a class from more than one direct base class). Because a derived class can include its own class variables, properties and methods, a derived class is often larger than its base class. A derived class is more specific than its base class and represents a smaller group of objects. Every object of a derived class is also an object of that class s base class. However, base-class objects are not objects of that class s derived classes. Derived-class methods and properties can access protected base-class members directly. An is-a relationship represents inheritance. In an is-a relationship, an object of a derived class also can be treated as an object of its base class. A has-a relationship represents composition. In a has-a relationship, a class object has references to one or more objects of other classes as members. A derived class cannot access private members of its base class directly. A derived class can access the public, protectedand internal members of its base class if the derived class is in the same assembly as the base class. When a base-class member is inappropriate for a derived class, that member can be overridden (redefined) in the derived class with an appropriate implementation. To override a base-class method definition, a derived class must specify that the derived-class method overrides the base-class method with keyword override in the method header. Inheritance relationships form tree-like hierarchical structures. A class exists in a hierarchical relationship with its derived classes.
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.