Encapsulation, Inheritance, Interfaces, Abstraction, Polymorphism
in-her-it, verb
. to derive an attribute from one's parent or ancestors
property
A ___________ can be used to get or set a backing field (i.e. a field set by a property).
abstract method
A method that has a declaration but no statements or method body.
rue
An Interface is similar to a contract (or checklist) for a class on what methods must be put into the class. true or false
true
Encapsulation helps you prevent bugs in your program. true or false?
class
Encapsulation means having one _______ hide information from another.
Adding a TabControl to Form • Create a Windows Form application called Tab and save all to Desktop. • Add TabControl to the Form (Toolbox/Containers). • Resize and reposition to the Form size.
How do you add a TabControl control to a form?
B. ***public const int daysPerYear = 365;
Identify from a list a valid use of a const modifier. A. public const bool daysPeryear = 365; B. public const int daysPerYear = 365; C. public const string daysPeryear = 365;
transitive model
If ClassC is derived from ClassB, and ClassB is derived from ClassA, ClassC inherits the members declared in ClassB and ClassA. This is an example of the _____ model
A. first
If a class has a constructor then it is the ____________ thing that gets executed when the class is created with a new statement. A. First B. Last C. Middle
implementation
In encapsulation, the ____________ (the internal workings) of an object is hidden from the rest of the program. MessageBox.Show("Hello, World!"); •You do not know how the MessageBox class displays itself when you call Show( ). You do not have to and you probably do not want to.
Interface.
Know that when you need to group your objects together based on the things they can do rather than the classes they inherit from you would use an _____.
Polymorphism.
The ability of a type to be treated as any of its base types or any of the interfaces it inherits.
accessors.
The get and set portions of a property or indexer are called ____________.
true
The new keyword does not override, it signifies a new method that has nothing to do with the base class method. true or false
before
The new keyword is placed _______ the return type of a class member that is being replaced. before after
camelCase
Use _______Case for private fields
PascalCase
Use _______Case for public fields
Add the virtual keyword to the method in the base class •Add a method with the same name to the subclass
What are the 2 steps to override a base class?
superclasses •parent classes
What are the common synonyms for base classes?
•derived classes •child classes
What are the common synonyms for subclasses?
class SubClassName:BaseClassName { }
What is the inheritance syntax?
abstract
What is the keyword added to a class to make it an abstract class?
Console Applications
What is the name of applications that take input and display output at the command line console?
_overriding___
When a subclass changes the behavior of a method it inherited, it is called __________.
hidden members
When the new keyword is used, the new class members are called instead of the base class members that have been replaced. Those base class members are called ____________________. ______________ can still be called if an instance of the subclass is cast to an instance of the base class.
true
When used correctly, inheritance will help you write code that is easy to maintain true or false
_base class__ __subclass_____.
When working with inheritance, the class whose members are inherited is called the ________ and the class that inherits those members is called the ________
uppercase I
Whenever you create an interface, you should make its name start with an _____.
D. All of the above
Which of the following are benefits of inheritance? A. When your classes use inheritance you only have to write your code once. B. You subclass an object to get its behavior, but keep the flexibility to make changes to that behavior. C. You can avoid duplicate code, model real world applications more closely, and end up with code that is easier to maintain. D. All of the above
D. A benefit of encapsulation in coding is it makes your classes easier to use.
Which of the following statements are correct: A. When creating classes, it is good practice to make all fields and methods public. B. A benefit of encapsulation in coding is it makes your classes more rigid. C. A benefit of encapsulation in coding is it makes your classes harder to maintain. D. A benefit of encapsulation in coding is it makes your classes easier to use.
polymorphism
You are using ________ when you take an instance of one class and use it in a statement or a method that expects a different type, like a parent class or an interface that the class implements.
B. •public fields and methods
__________ are accessible from anywhere in the program. the same class. A. •private fields and methods B. •public fields and methods
A. •private fields and methods
_____________ are only accessible from within the instance itself, and other instances of the same class. A. •private fields and methods B. •public fields and methods
• Properties
_______________ are methods that look just like fields to other objects.
Accessors
________________ enable data to be accessed easily and still helps promote the safety and flexibility of methods.
Console applications
__________________ are useful for utility programs that require little or no user interaction.
subclass → InformationSystems base class → Exam
class InformationSystems : Exam { } subclass → ________________ base class → ______________
Polymorphism.
the ability of derived classes (subclasses) to be substituted for their ancestors - objects can take many different forms
• Polymorphism
the ability of derived classes to be substituted for their ancestors - objects can take many different forms (CH 7).
Inheritance
the ability of types to inherit behavior from a base (CH 6).
• Inheritance
the ability of types to inherit behavior from a base (CH 6).
Abstraction -
the elimination of unnecessary or irrelevant detail (CH 7).
• Abstraction
the elimination of unnecessary or irrelevant detail (CH 7).
• Encapsulation
the hiding of implementation details (CH 5).
true
true or false Inheritance allows you to subclass an object to get its behavior, but keep the flexibility to make changes to that behavior.
false
true or false When your classes use inheritance you have to write your code multiple times to get it to work.
__implement
you do NOT inherit from an interface you _________ from an interface.
property
• A ______________ is a member that provides a flexible mechanism to read, write, or compute the value of a private field.
D. All of the above This describes Inheritance being transitive
• Inheritance enables you to create new classes that ______ the behavior that is defined in other classes. A. reuse B. extend C. modify D. All of the above
accessors.
• Properties can be used as if they are public data members, but they are actually special methods called ________.
use, maintain, flexible
•Encapsulation makes classes... •Easy to ______ •Easy to _________ •___________
private.
•If you leave off the private or public keywords then C# will just assume that your field is ______________.
inherit
•When you have two classes that are more specific cases of something more general, you can set them up to _______ from the same class.