100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
cos2614 exam pack 2023 , pass with 100% $5.84   Add to cart

Exam (elaborations)

cos2614 exam pack 2023 , pass with 100%

  • Course
  • Institution

This document contains everything you need to pass cos2614

Preview 4 out of 39  pages

  • October 12, 2023
  • 39
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
BASIC CONCEPTS OF OBJECTS ORIENTED PROGRAMMING

Review of the following OOP concepts



1. Objects



2. Classes



3. Data abstraction and encapsulation



4. Inheritance



5. Polymorphism



6. Dynamic binding



7. Message passing



OBJECTS




Objects are the basic run-time entities in an object-oriented system. They may represent a person, a
place, a bank account, a table of data, or any item that the program must handle.



The fundamental idea behind the object-oriented approach is to combine both data and function
into single units and these units are called objects.



The term objects mean a combination of data and programs that represent some real word entity.
For example: consider an example named Siya; Siya is 25 years old and his salary is R2500. The Amit
may be represented in a computer program as an object. The data part of the object would be
(name: Siya, age: 25, salary: R2500)

,The program part of the object may be a collection of programs (retrieve of data, change age, change
of salary). In general, even any user-defined type-such as an employee may be used. In the Siya
object the name, age, and salary are called attributes of the object.



CLASS:




A group of objects that share common properties for the data part and some program parts is
collectively called a class.



In C ++ a class is a new data type that contains member variables and member functions that operate
on the variables.




DATA ABSTRACTION :



Abstraction refers to the act of representing essential features without including the background
details or explanations. Classes use the concept of abstraction and are defined as attributes and
functions to operate on the attributes.



DATA ENCAPSULATION:




The wrapping up of data and function into a single unit (called class) is known as encapsulation. The
data is not accessible to the outside world and only those functions which are wrapped in the class
can access it. These functions provide the interface between the object's data and the program.



INHERITANCE :




Inheritance is the process by which objects of one class acquire the properties of another class. The
concept of inheritance provides the idea of reusability. This means that we can add additional
features to an existing class without modifying it. This is possible by designing a new class that will
have the combined features of both classes.

,POLYMORPHISM:




Polymorphism means the ability to take more than one form. An operation may exhibit different
instances. The behavior depends upon the type of data used in the operation. Polymorphism is a
language feature that allows a function or operator to be given more than one definition. The types
of the arguments with which the function or operator is called determine which definition will be
used.



DYNAMIC BINDING :




Binding refers to the linking of a procedure call to the code that is executed in response to the call.
Dynamic binding means the code associated with a given procedure call is not known until run-time.
It is associated with a polymorphic reference depending upon the dynamic type of that reference.



MESSAGE PASSING :




An object-oriented program consists of a set of objects that communicate with each other.



A message for an object is a request for execution of a procedure and therefore will invoke a function
(procedure) in the receiving object that generates the desired result. Message passing involves
specifying the name of the object, the name of the function (message), and the information to be
sent.




BENEFITS OF OOP:



OOP offers several benefits to both the program designer and the user. Object-oriented contributes
to the solution of many problems associated with the development and quality of software products.

, The principal advantages are :



1. Through inheritance we can eliminate redundant code and extend the use of existing classes.



2. We can build programs from the standard working modules that communicate with one another,
rather than having to start writing the code from scratch. This leads to saving development time and
higher productivity.



3. This principle of data hiding helps the programmer to build secure programs that can’t be
invaded by code in other parts of the program.



4. It is possible to have multiple instances of an object co-exist without interference.



5. It is easy to partition the work into a project based on objects.



6. Object-oriented systems can be easily upgraded from small to large systems.



7. Message passing techniques for communication between objects make the interface description
with external systems much simpler.



8. Software complexity can be easily managed.

LESSON

LESSON
CLASSES

A Class is a group of objects that share common properties and relationships.
In C++, a class is a new data type that contains member variables and member function
s that operates on the variables. A class
is defined with the keyword class. It allows the data
to be hidden, if necessary from external use. When we define
a class, we are creating a new abstract data type that can be treated like any other built-
in data type.
Generally, a class specification has two parts:

a) Class declaration

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller elenaprowriter. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $5.84. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

83430 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$5.84  1x  sold
  • (0)
  Add to cart