Shared Flashcard Set

Details

MSDN: OOP (C# and Visual Basic)
Review of Object-Oriented Programming (C# and Visual Basic) from http://msdn.microsoft.com/en-us/library/dd460654.aspx#Members
36
Computer Science
Professional
09/22/2012

Additional Computer Science Flashcards

 


 

Cards

Term
What is encapsulation?
Definition
Group of related properties, methods, and other members which are treated as a single unit or object.  Can describe either restriction for an object's members, or facilitation of bundling data with methods operating on that data.
Term
What is inheritance?
Definition
The ability to create new classes based on existing classes.  The derived class can be reused, extended, or modified.
Term
What is polymorphism?
Definition
The ability to use multiple classes that can be used interchangeably, even though each class implements the same properties or methods in a different manner.
Term
What is a class?
Definition
Defines the type of an object.
Term
What is an object?
Definition
A usable instance of a class.
Term
What is instantiation of an object?
Definition
The act of creating the object is instantiation.
Term
What are structures (struct)?
Definition
A value typically used to encapsulate small groups of related variables.
Term
What type of information can a structure (struct) contain?
Definition
Can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types.  If you use all of these however, consider defining a class instead of a struct.
Term
What is a benefit of using a structure (struct) over a class?
Definition
If creating a large array of objects the struct has a smaller memory footprint.  Classes implicitly inherit memory overhead from type Object.
Term
What are class members?
Definition
Can include properties that describe class data, methods that define behavior, and events that provide communication between different classes and objects.
Term
What are properties and fields?
Definition

Fields and properties represent information within an object.  Fields are like variables because that can be read or set directly.  Properties have accessors and mutators.

 

Term
What is a method?
Definition
An action that an object can perform.
Term
What are events, and what design pattern do events follow?
Definition
Events enable a class or object to notify other classes or objects when something of interest occurs.  C# events follow the publish/subscribe pattern. 
Term
What is the publish/subscribe design pattern?
Definition
Publishers or subscribers of messages programmatically only look at messages of interest.  Publishers messages are characterized into classes without any knowledge of subscribers.  These subscribers will express interest in one or more classes, and only recieve messages that are of interest without any knowledge of publishers.
Term
What are nested classes?
Definition
Classes defined within another class.  These classes are private by default.
Term
What are access modifiers and access levels?
Definition
Access modifiers describe access level between other classes and assemblies (C#).
Term
What is a protected access modifier denote?
Definition
Access in same or derived class.
Term
What does the internal access modifier denote?
Definition
Access within same assembly.
Term
What does protected internal access modifier denote?
Definition
Access within same assembly or derived class.
Term
What are static classes and members?
Definition
Static classes and members can be accessed without an instantiation of a class.  A member of the class is a property, procedure, or field that is shared by all instances of a class.
Term
What are anonymous types?
Definition
A "class" with no usable name and contains the properties you specify, the compiler generates class.
Term
What is a reference type?
Definition
A variable that contains the address of the location in memory where data is stored.  Can reference class, interface, or delegate.
Term
What is a boxed variable?
Definition
A value type that is converted to type Object.
Term
What is an unboxed variable?
Definition
A variable of type Object that is converted to a value type.
Term
What is a string?
Definition
A reference type representing a sequence of zero or more unicode characters.
Term
How is a string different from other reference types?
Definition
boolean equivalence is evaluated by values within reference, rather than comparing the references between two strings.  Strings are immutable, and the compiler creates new string references when a string changes (old string is marked for garbage collection). 
Term
What is a verbatim string?  What is it useful for?
Definition
Syntax:  @"string contents";  Usefule for compiler options, sql queries, paths, or anything that requires much escaping.  Double qoutes are escaped with another double quote.
Term
What is an abstract class?
Definition
A class that can be used as a base class and cannot be instantiated.
Term
What is useful about overriding members when using inheritance?
Definition
Changes bejavior of inherited members.  Can define new implementation of the method, property, or event in derived class.
Term
What does the virtual modifier do when found in the base class?
Definition
Derived class can override member.
Term
What does the override modifier do when found in the derived class?
Definition
Is required when extending or modifying the abstract or virtual implementation of an inherited method, property, indexer, or event.
Term
What does the abstract modifier do when found in the base class?
Definition
Forces the implementation of member in derived classes.
Term
What is the new modifier do when found in the derived class?
Definition
Forces reimplementation of inherited member when virtual and abstract are not specified by that member's prototype.
Term
What is an interface?
Definition
Defines a set of properties, methods, and events without any implementation.  An interface represents a contract to be implemented.
Term
What is a generic?
Definition
Classes, structures, interfaces that type parameters that define types of objects that they can store or use.
Supporting users have an ad free experience!