Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
9 views
c++ programming
notes
Uploaded by
anandyadav88793244
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save c++ programming For Later
Download
Save
Save c++ programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
9 views
c++ programming
notes
Uploaded by
anandyadav88793244
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save c++ programming For Later
Carousel Previous
Carousel Next
Save
Save c++ programming For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 8
Search
Fullscreen
11 INTRODUCTION Object-Oriented Parady cus real Ife objects Wis | programing any solution. By focusing real life objects, we Mean that Ove, solutions revolves around different objects, which represent Tespectiyg | objects in real life situation, : Object-oriented Progra: where all computations imming, or OOP, is an approach to Problem-solvig 5 are carried out using objects, Traditional programming techniques using data real-world Concepts, Object-oriented Programmi language model organized around objects rath than logic, Hence, emphasis is given Procedures, In OOP, code and dats ar¢ merged into a single indivisible thing - an object. So, programs are divided into what are as objects, Data Structures are designed such that they characterize the objects. and functions do not moda | ing (OOP) isa Programming | ler than “actions” and datz | More on data rather than Functions that operate on the data of an object are tied together in the datz structure, } Chg Object B Data Functions muse 7 Functions Data Yigure 11 : Organteation of Data and Functions in OOP1.2 ‘ADVANTAGES AND DISADVANTAGES OF PROCEDURE ORIENTED LANGUAGES excrete etodeeay ore Data is hidden using Encapsulation property and cannot be accessed by external functions. This characteristic of data hiding provides greater system security and avoids unintended data corruption. Functions are used for objects to communicate with each other. Object Oriented Language tries to make parts of programs easily reusable and extensible. Hence, new data and functions can be easily added whenever necessary. It follows bottom- up approach in program design. The organization of data and functions in object-oriented programs is as shown in Figure 1.1. The data of an object can be accessed only by the functions associated with that object. However, functions of one object can access the functions of other objects. procedure-Oriented Languages (POLs) focus on writing functions (or procedures) to perform tasks, like a recipe with steps. Examples are C and Pascal. [ADVANTAGES OF PROCEDURE-ORIENTED LANGUAGES : 1 Easy to Break Down : You can divide a big task into smaller steps (functions), making the program easier to handle. Re-use Code: Once you write 4 function, you can use it again and again without rewriting it. Clear Process Flow : It follows a logical order, like a step-by-step instruction manual. Siniple to Learn: Good for smalll projects; easy to understand when starting out. Fast and Efficient : Since you control how the computer uses memory; the programs can run fast. DisabvANTAGES OF PROCEDURE-ORIENTED LANGUAGES : Hard to Manage Large Programs : For big projects, keeping track of everything gets messy and hard to maintain. No Protection for Data : Any part of the program can change important data, No Inheritance : Unlike object-oriented languages, you can} which may lead to errors. not create new features by building on existing code, so you may repeat yourself more.a ented Programming using C++ (Ry, ; oo Object Orient 886 an, a 4. Less Focus on Data: ce Itis more about the steps (functions) than organizing or protecting the data, 5, Not Ideal for Real-World Modeling : It is harder to model real-world things like cars or users because the langua, focuses more on tasks than objects. Be 1,3 APPLICATION OF OOPS Here are some simple applications of Object-Oriented Programming (op), 1, Building User-Friendly Apps : i) Examples : Mobile apps, games, web browsers. ii) OOP helps create buttons, windows, and menus as objects, making it eas, 2 design apps with a user-friendly interface. 'Y to 2. Real-World Systems : : i) Examples: Train ticket booking, traffic systems. ii) OOP models real-world items like trains, tickets, and passengers as objects, making it easier to manage large, complex systems. 3. Simulations: i) _ Examples : Weather forecasting, business simulations. ii) OOP helps simulate real-world objects like clouds or financial markets, making it easier to predict outcomes. 4.. Cloud and Networked Applications : i) Examples : Cloud storage (Google Drive), online games. \i) OOP allows objects to exist on different computers, making it easier to build apps that work over the internet. 5. Managing Large Databases : 1) Examples : Online shopping sites, banking systems. fl) OOP uses objects to represent data like customer info or product details, making it easier to store and manage huge amounts of data. 6. Design Software : ') Examples: Architecture design, 3D modeling tools. if) OOP helps create complex designs, like buildings or machine parts, by modeling each part as an object. 7. Artificial Intelligence (Al) : {) Examples : Voice assistants (Siri), fl) OOP helps Al systems work by like users, images, or command: image recognition. using objects to represent different things, is.Ez yc orentd Methodology wee s q, Business Applications : i) Examples: Inventory systems, customer management. ii) OOP makes it easy to organize things like customers, products, or orders into objects, helping businesses run smoothly. 9, Game Development: i) Examples : Video games (e.g., FIFA, Call of Duty). ii) OOP lets developers create characters, weapons, and levels as objects, making games more interactive and realistic. 10. Security Systems : i) Examples : Password management, fingerprint scanners. i) OOP helps secure data by using objects to manage users and access rights. 11. Websites: i) Examples : Online stores, social media sites. ii) OOP helps build websites by representing users, posts, and products as objects, making web development more organized. In short, OOP makes it easier to model real-world things (like cars or users) as objects in code, which simplifies programming for complex applications. [1-4 PrincipLes OF OOPS 14.1 Opjects = Anobject represents an entity in the real world. «Definition : An object incorporates the combination of the set of data values as data members, and the set of operations as member function. = Each object has its own properties or characteristics that describe what it is or does. = For example, the properties of a Person object would be : Name, Age, Weight. = Some properties ofa Car object would be : Color, Weight, Model-year, Engine power, number of wheels. * An object also executes some actions. The actions a Car is capable of are: Start, Stop, Accelerate, Reverse. "The match between programming objects and real-world objects is the result of combining the properties and actions of an object. "= Whena program is executed, the objects interact by sending messages to one another. x ‘i Oriented Programming using C+: FYB.Sc. (IT) (Semester-I1)1.4.2 CLASSES . Each object is said to be an instance of its class. - Object Oriented Programming using C++ (FY.RSe, apy! wor OF Smtr ‘There are two ways of representing an object : h Object : CAR CAR | object:CAR . DATA Color Weight Model-Year ae Engine Poer ‘Number of Wheels a Accelerate FUNCTIONS I Start Stop Accelerate Reverse Start Reverse Figure 1.2 : Two Ways of Representing An Object Definition : A class is a group of objects that have the same Properties, common behavior, and common relationships. ‘The Class defines the characteristics that the object is to possess. However, values can be assigned only after an object is created. Class is a user defined data type, which holds its own data members and member functions, which can be accessed and used by creating instance of that class. For example, in a class of Polygons, a triangle, a square, a parallelogram, a rectangle and so on, is objects. a Class: Polygon. a Properties : Vertices, Border Color, Fill Color. © Methods : Draw, Erase, Move. The variables inside class definition are called as data members and the functions are called member functions. Property / Attribute / Data Member : The characteristic of the object is represented as the variables in a class and referred to as the properties or attributes of the class. For example, each polygon in a class has a name, vertices and edges, border color and fill color. All polygons in the class share these common properties. Method / Member Functions : All objects in a class perform certain common actions or operations. An action required of an object or entity represented in a class, is called a method. In a polygon class “draw”, “erase” and “move” are examples of the methods that are part of the class.r 144 L485, ented Method!” " rr ori 4, DATA EN \CAPSULATION at, pefinition : Encapsulation is the ; Properties and methods in a class, process that allows selective hiding of ‘The wrapping up of data and functi | known as Encapsulation. ctions into a single unit (called class) is The data is not accessible to the outsid tions which are wrapped in the class can ae wera and only those function All communication to an object is done vi interface to the object. e via messages. Messages define the So, these functions provide the interface between the object's data and the program. Providing access to an object only through its messages, while keeping the details private is called information hiding. When we properly encapsulate some code, we achieve two objectives : o We build an impenetrable wall to, protect the code from accidental corruption due to the minor errors that weare all prone to make. 1 We also isolate errors to small sections of code thereby making them easier to find and fix. DATA ABSTRACTION Definition : Data Abstraction is the process of identifying properties and methods related to a particular entity as relevant to the application. Common definitions are stored once per class rather than once per instance of the class. Methods can be written once for a class, so that all the objects in a class benefit from code reuse. For example, all ellipses share the same methods to: - draw them, compute their area, test for intersection with a line. In Object oriented programming data abstraction is defined asa collection of data and methods, which is what an object represents. INHERITANCE we use the concept of classes being divided into subclasses. Inour daily lives, trucks, buses, We know that a class of vehicles can be divided into-cars, motorcycles etc. Definition : Inheritance is the process by which the objects of one class acquire the properties of objects of another class. Inheritance is the property that allows the reuse of an existing class to build anew class. The principle in this sort properties with the class fr For example, all vehicles in a class wheels and a motor. of division is that each subclass shares common om which it is derived. may share similar properties of havingveer Object Ortented Programming using C+* (2 ¥.0 on Sen, the subclass may have Its own particular characteristi 4 es, Inadaition, tes example, a bus may have seats for people, while trucks hay carrying pods. Paty, rene as ners al the behavor of he original lass an yy aly * have its additional features. The original class is called the base class or super class, or parent the new class. a The new class is called the derived class, or subclass, or child clas ar OF original class. superclass is the class from which another class inherits its behavior The class that inherits the properties and methods of another class is Caley the subclass. In OOP, the concept of inheritance provides the idea of reusability, Note : Each subclass defines only those features that are unique to it, Vehicles _ Super Class / Parents Class / Base Class cars| [_Truts_] Buses Motorcycles Sub Class / Child Class / Derived Class Figure 1.3 A subclass is said to be a specialization of its superclass, and conversely, a super class is a generalization of its subclasses. 1.4.6 POLYMORPHISM Definition : Polymorphism means the ability to take more than one form at different times. In simple terms, polymorphism is the attribute that allows one interface to be used with a general class of actions. Shape Draw () Circle Object__| Box Object Triangle Object Draw (Circle) | Draw (Box) Draw (Triangle) Figure 1.4 = The above figure illustrates thata single function name can be used to handle different number and different types of arguments.yr ST | ethodol tet Methodoloay weer ore . 9 pet = @ method or function, which all the subclasses of the class Shape However, the Draw method that box and that for a triangle will be differe! fe implemented for a circle or for a bo: Hence, polymorphism promotes Encapsulation. Itis extensively used in implementing inheritance. 147, DYNAMICBINDING 1.48 MESSAGE PASSING Binding refers to the linking of a procedure call to the code to be executed in response to the call, Dynamic Binding (also known as late binding) means that the ciated with a given procedure call is not known until the time of the call run time. Itis associated with polymorphism and inheritance. code asso- I at A function call associated with a polymorphic reference depends on the dynamic type of that reference. f information by the Message Passing is nothing but sending and receiving 0 is helps in building objects same as people exchange information. So, thi: systems that simulate real life. ‘An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language therefore involves the following basic steps : a _. Creating classes that define objects and their behavior. 0 Creating objects from class definitions. a Establishing communication among objects. ‘A message for an object is a request for execution of procedure, and therefore will invoke a function that generates the desired result. In OOPs, Message Passing involves specifying the name of objects, the name of the function, and the information to be sent. rrr
You might also like
CPP New
PDF
No ratings yet
CPP New
112 pages
OOPM UNIT 1 (Cse)
PDF
No ratings yet
OOPM UNIT 1 (Cse)
64 pages
Oop
PDF
No ratings yet
Oop
50 pages
Oop Concepts N
PDF
No ratings yet
Oop Concepts N
12 pages
Bsccsit Com C
PDF
No ratings yet
Bsccsit Com C
141 pages
Chap 1
PDF
No ratings yet
Chap 1
21 pages
Introduction To Object Oriented Programming: UNIT-1
PDF
No ratings yet
Introduction To Object Oriented Programming: UNIT-1
30 pages
Oops 1
PDF
No ratings yet
Oops 1
137 pages
Unit-1 Notes
PDF
No ratings yet
Unit-1 Notes
35 pages
Book 31 Mar 2025
PDF
No ratings yet
Book 31 Mar 2025
4 pages
Unit-1 (Part-A) Notes of OOPS by Updesh Kumar - Updated
PDF
No ratings yet
Unit-1 (Part-A) Notes of OOPS by Updesh Kumar - Updated
29 pages
oose
PDF
No ratings yet
oose
55 pages
Sem-2 BCA-CPP notes(1)
PDF
No ratings yet
Sem-2 BCA-CPP notes(1)
64 pages
Why Do We Need OOP?: Monolithic
PDF
No ratings yet
Why Do We Need OOP?: Monolithic
4 pages
EC104 Unit4
PDF
No ratings yet
EC104 Unit4
21 pages
Unit1 Oosd
PDF
No ratings yet
Unit1 Oosd
14 pages
The Evolution of Object Oriented Programming
PDF
No ratings yet
The Evolution of Object Oriented Programming
7 pages
MCS-024 Solved Assignment 2015-16
PDF
100% (1)
MCS-024 Solved Assignment 2015-16
85 pages
OOP_Chapter1
PDF
No ratings yet
OOP_Chapter1
19 pages
Lecture 1
PDF
No ratings yet
Lecture 1
26 pages
Dcap107 Dcap404 Object Oriented Programming PDF
PDF
No ratings yet
Dcap107 Dcap404 Object Oriented Programming PDF
329 pages
B.Sc-III NEP JAVA UNIT-2
PDF
No ratings yet
B.Sc-III NEP JAVA UNIT-2
21 pages
C++ Introduction - BU BCA
PDF
No ratings yet
C++ Introduction - BU BCA
6 pages
C Unit-1
PDF
No ratings yet
C Unit-1
19 pages
Class - Ix Subject - Computer Application Chapter 1-Introduction To Object Oriented Programming Concept
PDF
No ratings yet
Class - Ix Subject - Computer Application Chapter 1-Introduction To Object Oriented Programming Concept
7 pages
Ooc Mod1@Azdocuments - in
PDF
No ratings yet
Ooc Mod1@Azdocuments - in
50 pages
Unit 1
PDF
No ratings yet
Unit 1
6 pages
chap 1 oopnotes
PDF
No ratings yet
chap 1 oopnotes
19 pages
Event Driven Programming
PDF
No ratings yet
Event Driven Programming
30 pages
Adobe Scan 14 Apr 2025
PDF
No ratings yet
Adobe Scan 14 Apr 2025
25 pages
OOP Unit 1 Content 1
PDF
No ratings yet
OOP Unit 1 Content 1
33 pages
1.Object Orientation Programming
PDF
No ratings yet
1.Object Orientation Programming
37 pages
C++ Presentation 3
PDF
No ratings yet
C++ Presentation 3
39 pages
Lecture 2
PDF
No ratings yet
Lecture 2
25 pages
301 Oops C++
PDF
No ratings yet
301 Oops C++
357 pages
PAN African E-Network Project: Pgdit
PDF
No ratings yet
PAN African E-Network Project: Pgdit
79 pages
Data Structures and Design Notes
PDF
No ratings yet
Data Structures and Design Notes
74 pages
Oop PDF
PDF
No ratings yet
Oop PDF
27 pages
Object_Oriented_Programming_Chapter_One_Introduction_New_2018
PDF
No ratings yet
Object_Oriented_Programming_Chapter_One_Introduction_New_2018
49 pages
Oops Java Mod 1
PDF
No ratings yet
Oops Java Mod 1
50 pages
Introduction To Object Oriented Programming
PDF
No ratings yet
Introduction To Object Oriented Programming
9 pages
Basics of Object Oriented Programming
PDF
No ratings yet
Basics of Object Oriented Programming
5 pages
Assigment C#
PDF
No ratings yet
Assigment C#
6 pages
CPP Unit-1
PDF
0% (1)
CPP Unit-1
73 pages
01 Oop
PDF
No ratings yet
01 Oop
60 pages
Sem-2 BCA-CPP notes
PDF
No ratings yet
Sem-2 BCA-CPP notes
20 pages
Iv Semester Ooc (18CS45) Notes
PDF
No ratings yet
Iv Semester Ooc (18CS45) Notes
181 pages
Chapter 1- IntroductiontoOOP
PDF
No ratings yet
Chapter 1- IntroductiontoOOP
29 pages
Lecture-2-Basic Concept Oop
PDF
No ratings yet
Lecture-2-Basic Concept Oop
15 pages
Oop L-1
PDF
No ratings yet
Oop L-1
13 pages
1.1 Procedure Oriented Programming: Main Program
PDF
No ratings yet
1.1 Procedure Oriented Programming: Main Program
9 pages
CH 2-OOP Concepts
PDF
No ratings yet
CH 2-OOP Concepts
32 pages
5 General OOP Concepts
PDF
No ratings yet
5 General OOP Concepts
30 pages
Oops Notes
PDF
No ratings yet
Oops Notes
162 pages
Unit 1 Content
PDF
No ratings yet
Unit 1 Content
34 pages
Comp. Oops Notes....
PDF
No ratings yet
Comp. Oops Notes....
6 pages
CPP Module 1 New
PDF
No ratings yet
CPP Module 1 New
37 pages
CCquestion bank cc
PDF
No ratings yet
CCquestion bank cc
1 page
html-all-tags-chart
PDF
No ratings yet
html-all-tags-chart
8 pages
Cultural Objectives
PDF
No ratings yet
Cultural Objectives
6 pages
FYBBI Cultural Notes
PDF
No ratings yet
FYBBI Cultural Notes
5 pages
azhar ins journal
PDF
No ratings yet
azhar ins journal
11 pages
Assignment 3 INS
PDF
No ratings yet
Assignment 3 INS
7 pages
All cp Gst
PDF
No ratings yet
All cp Gst
55 pages
151b4f82-6a42-4e70-adaa-3fdbf1b25ba3
PDF
No ratings yet
151b4f82-6a42-4e70-adaa-3fdbf1b25ba3
1 page
Computer Laboratory Management System using PHP and MySQL - vuln 2
PDF
No ratings yet
Computer Laboratory Management System using PHP and MySQL - vuln 2
1 page