exam review 1.docx

2 Pages
87 Views
Unlock Document

Department
Computer programming
Course
Comp2129
Professor
Tom Yeung
Semester
Fall

Description
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 embrace: ■ 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 inherit
More Less

Related notes for Comp2129

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit