Study Guides (390,000)
CA (150,000)
UofM (800)
COMP (10)

exam review 1.docx

Computer Science
Course Code
COMP 2150
John Anderson
Study Guide

This preview shows half of the first page. to view the full 2 pages of the document.
For a language to be considered a true object-oriented programming (OOP) language, it
must support the following four major concepts, which C# and the .NET platform
Abstraction: The language must provide a way to manage complex problems by
allowing you to abstract or identify the objects involved in the problem.
Encapsulation: The language must provide support for packaging data attributes
and behaviors into a single unit, thus hiding implementation details.
Polymorphism: The language must enable multiple implementations of the
same behaviors so that the appropriate implementation can be executed based on
the situation.
You encapsulated or packaged these
common characteristics into a single entity labeled . Through defining the data
members as private, you protected the data and enabled access only through the object’s
methods and properties.
Inheritance allows you to create a general class and then define specialized classes that
have access to the members of the general class.These new specialized classes can extend
by adding their own new unique data and behaviors. Inheritance is associated
with an “is a” relationship.A specialized class “is a” form of the general class.
The class is sometimes called the super or parent class.
Access to members that have been defined with the private access modifier is restricted to
members of the current class.The private members are not accessible to other classes
that derive from this class or that instantiate objects of this class. Using a private access
modifier enables the class to protect its data and only allow access to the data through its
methods or properties.This ensures the data-hiding characteristic of encapsulation.
Constructors, named the same name as the class
name, are defined with access. It is important to note that if you do not use a
public access modifier with constructors, no objects can be instantiated from the class.
Constructors differ from other methods in that they cannot have a type
When you override a method, you replace
the method defined at a higher level with a new definition or behavior. Notice that the keyword
override is added onto the ToString( ) method heading and virtual is added
onto the GetSleepAmt( ) method heading. Placing virtual in the method heading allows
the method to be overridden.
Overriding a method differs from overloading a method. An overridden method must
have exactly the same signature as the method it is overriding. New functionality is normally
defined with overridden methods.
The override keyword allows a method to provide a new implementation of a method
inherited from a base class.When you override a method, the signature of the methods
You're Reading a Preview

Unlock to view full version