Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

cos2614 exam pack 2023 , pass with 100%

Rating
-
Sold
1
Pages
39
Grade
A+
Uploaded on
12-10-2023
Written in
2023/2024

This document contains everything you need to pass cos2614

Institution
Course

Content preview

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

Written for

Institution
Course

Document information

Uploaded on
October 12, 2023
Number of pages
39
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$6.26
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
elenaprowriter University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
105
Member since
5 year
Number of followers
71
Documents
22
Last sold
1 month ago

3.5

13 reviews

5
3
4
4
3
4
2
1
1
1

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions