Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


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.
Your email address is only used to allow you to reset your password. See 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.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
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
Popular Engineering sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards