100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
H1: "Fundamentals of OOP: Classes, Objects, and Inheritance" H2: "Advanced OOP Concepts: Polymorphism, Encapsulation, and Operator Overloading" $5.48   Add to cart

Class notes

H1: "Fundamentals of OOP: Classes, Objects, and Inheritance" H2: "Advanced OOP Concepts: Polymorphism, Encapsulation, and Operator Overloading"

 12 views  0 purchase
  • Course
  • Institution

The document I provided is a comprehensive guide to Object-Oriented Programming (OOP) in C++, organized with headings and subheadings to facilitate easy understanding and review. The document covers the fundamental concepts and techniques of OOP, including: - Classes and objects - Inheritance a...

[Show more]

Preview 4 out of 66  pages

  • June 16, 2024
  • 66
  • 2023/2024
  • Class notes
  • Mrs. v sailaja, dept. of computer science
  • B.sc i year/ii semester
avatar-seller
B.Sc I Year/II Semester UNIT I OOP’S USING C++

Introduction to C++
 C++ is an object-Oriented programming language. Initially named ‘C with Classes’,
C++ was developed by Bjarne Stroustrup at AT&T Bell Laboratories in New
Jersey, USA, on the early eighties.
 C++ is an extension of C with a major addition of the class construct feature of
SIMULA67.
 C++ is a superset of C. Most of what we already know about C applies to C++ also.
Therefore, almost all C programs are also C++ programs with slight modifications.
 The most important facilities that C++ adds on to C are classes, objects,
inheritance, function overloading, and operator overloading. These features
enable us to create abstract data types, inherit properties from existing data types
and support polymorphism, thus making C++ a truly object-Oriented Language.
 The Object-Oriented features in C++ allow programmers to build large programs
with clarity, extensibility and ease of maintenance, incorporating the spirit and
efficiency of C.

Features Object-Oriented Programming(OOPs)
Explain the features of OOPs.
The following are the some of the features to know extensively about the Object-
Oriented Programming.
1) Objects
2) Classes
3) Encapsulation
4) Inheritance
5) Multiple inheritance
6) Polymorphism
7) Dynamic hiding
8) Message Passing
9) Data Abstraction
10)Extensibility
11)Persistence

Mrs. V Sailaja, Dept. of Computer Science Page 1

,B.Sc I Year/II Semester UNIT I OOP’S USING C++

12)Genericity
13)Data binding
1) Object:
 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.
 Object is a collection of number of entities. Objects take up space in the
memory.
 Objects are instances of classes. When a program is executed , the objects
interact by sending messages to one another. Each object contains data and
code to manipulate the data.
 Objects can interact without having known details of each other’s data or
code.
 An object is considered to be a partitioned area of computer memory that
stores data and set of operations that can access that data.
2) Class :
 It is an abstract data type that contains data members and member functions
that operates on data. It starts with the keyword class.
 The entire set of data and code of an object can be made a user-defined data
type with the help of a CLASS.
 Objects are variables to type class. Once a class has been defined, we can
create any number of objects belonging to that class.
3) Encapsulation:
The wrapping of data and functions into a single unit 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 provides an
interface between object’s data and the program. This insulation of the data from
direct access by the program is called data hiding.
4) Inheritance:
 Inheritance is the process by which objects of one class acquire the
properties of objects of another class.
Mrs. V Sailaja, Dept. of Computer Science Page 2

,B.Sc I Year/II Semester UNIT I OOP’S USING C++

 That is, deriving a new class from existing class. Here new class is called
derived class where as existing class is called base class.
 In OOP, 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 deriving a new class from the existing one. The new class
will have the combined features of both the classes.
5) Multiple Inheritance:
The mechanism by which a class is derived from more than one base class is known
as multiple inheritance.
6) Polymorphism:
 Polymorphism is another important OOP concept.
 Polymorphism means the ability to take more than one form.
 For example, an operation may exhibit different behavior ion different
instances. The behavior depends upon the types of data used in the
operation.
 Function overloading and operator overloading are the examples of
polymorphism.
7) Data hiding:
We can hide the information of class like we can hide data and member
functions of a class by specifying private and protected members of class. Private
and protected members are not accessed by outside the class, thus we can hide the
data of a class.
8) Message Passing:
 An Object-Oriented program consists of a objects that communicate with
each other.
 Objects communicates with one another by sending and receiving
information much the same way as people pass messages to one another.
 A message for an object is a request for execution of a procedure, and
therefore will invoke a function in the receiving object that generates the
desired result.
Mrs. V Sailaja, Dept. of Computer Science Page 3

, B.Sc I Year/II Semester UNIT I OOP’S USING C++

 Message passing involves specifying the name of the object, the name of the
function and the information to be sent.
 Objects have a life cycle. They can be created and destroyed.
9) Data Abstraction:
Abstraction refers to the act of representing essential features without
including the background details or explanation. Since the classes use the concept of
data abstraction, they are known as Abstract Data Types (ADTs).
10) Extensibility: It is a feature which allows the extension of the functionality
of the existing software components. In C++, this is achieved through inheritance.
11) Persistence: The mechanism where the object outlives the program
execution time and exists between executions of a program is known as persistence.
12) Genericity: It is a technique for defining software components that have
more than one interpretation depending on the data type. In C++, genericity is
achieved by function templates and class templates.
13) Dynamic Binding: Binding refers to the linking of a procedure call to the
code to be executed in response to the call. Dynamic binding means that the code
associated with it given procedure call is not known until the time of the call at run-
time. It is associated with Polymorphism and Inheritance. A function call associated
with a polymorphic reference depends on the dynamic type of that reference.
Adding Comments in a program
 C++ introduces a new comment symbol “//”(double slash). Comments start with
a double slash symbol and terminate at the end of the line. A comment may start
anywhere in the line. The double slash comment is basically a single line
comment.
Ex: //this is an example

 The C comment symbols “/* , */are still valid and are more suitable for multiline
comments.

Ex: /*this is an example of

C++ program */.

Mrs. V Sailaja, Dept. of Computer Science Page 4

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 abbalde2627. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75759 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

Recently viewed by you


$5.48
  • (0)
  Add to cart