Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards
share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Chapter 11

Object-Oriented Programming: Inheritance

TermDefinition
Inheritance A form of software reuse in which a new class is created by absorbing an existing class's members and enhancing them with new or modified capabilities
Base Class The existing class from which a new class inherits members.
Derived Class The new class that is derived from the base class. Each derived class can become the base class for future derived class
Direct Base Class The base class from which the derived class explicitly inherits
Indirect Base Class Any class above the direct base class in the class hierarchy
Class Hierarchy Defines the inheritance relationships among classes. The class hierarchy begins with class object(which is the C# alias for System.Object in the Framework Class Library), which every class directly or indirectly extends(or "inherits from")
Single Inheritance The case in which a class is derived from one direct base class
Is-a Relationship Represents inheritance. In an is-a relationship, an object of a derived class can also be treated as an object of its base class
Has-a Relationship Represents composition. In a has-a relationship, an object contains as members references to other objects
Protected Access Modifier Using protected access offers an intermediate level of access between public and private. A base class's protected members can be accessed by members of that base class and by members of its derived class
Access Modifiers and Inheritance All non-private base-class members retain their original access modifier when they become members of the derived class - public members become public and protected members become protected members of the derived class
Overriding a Base Class Method To override a base-class method, a derived class must declare a method with keyword override and with the same signature(method name, number of parameters, and parameter types), and return type as the base-class method
Keywords Virtual and Abstract These keywords indicate that a base-class method can e overridden in derived classes
Override Modifier Declares that a derived-class method overrides a virtual or abstract base-class method. This modifier also implicitly declares the derived class method virtual and allows it to be overridden in derived classes further down the inheritance hierarchy
Base-Class Services The non-private methods and properties of a base class
Deriving Classes Good Programming Practice In practice, derived classes should depend only on the base-class services
Fragile(Brittle) Software When a small change in the base class can "break" derived-class implementation. You should be able to change the base-class implementation while still providing the same services to the derived classes
Class Object All classes inherit directly or indirectly from the object class(ystem.Object in the Framework Class Library), so its seven methods are inherited by all classes
1. Class Object's Seven Methods 1. Method[Equals]..Description[This method compares two object for equality and returns true if they're equal and false otherwise. It takes any object as an argument.
2. Class Object's Seven Methods When objects of a particular class must be compared for equality, the class should override method Equals too compare the contents of the two objects]....
3. Class Object's Seven Methods 2. Method[Finalize]...Description[This method cannot be explicitly declared or called. When a class contains a destructor, the compiler implicitly renames it to override the protected method Finalize,
4. Class Object's Seven Methods which is called only by the garbage collector before it reclaims an object's memory. The garbage collector is not guaranteed to reclaim an object, thus it's not guaranteed that an object's Finalize method will execute]...
5. Class Object's Seven Methods 3. Method[GetHashCode]...Description[A hashtable data structure relates objects, called keys, to corresponding objects, called values.]...4. Method[GetType]...Description[Every object knows its own type at execution time.
6. Class Object's Seven Methods Method GetType returns an object of class Type(namespace System) that contains information about the object's type, such as its class name(obtained from Type property FullName)...
7. Class Object's Seven Methods 5. Method[Memberwise-Clone]...Description[This protected method, which takes no arguments and returns an object reference, makes a copy of the object on which it's called.
8. Class Object's Seven Methods The implementation of this method performs a shallow copy - instance-variable values in one object are copied into another object of the same type. For reference types, only the references are copied.]...
9. Class Object's Seven Methods 6. Method[Reference-Equals]...Description[This static method receives two object references and returns true if they're the same instance or if they're null references. Otherwise, it returns false.]...
10. Class Object's Seven Methods 7. Method[ToString]...Description[This method returns a string representation of an object. The default implementation of this method returns the namespace followed by a dot and the class name of the object's class]
Created by: TimC#Programming