Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
College aantekeningen

C++ NOTES FROM HELLO WORLD TO ADVANCED

Beoordeling
-
Verkocht
-
Pagina's
222
Geüpload op
04-03-2023
Geschreven in
2022/2023

THIS DOCUMENT CONTAINS C++ NOTES .FROM BIGINNING TO ADVANCED .WITH PROGRAMS .YOU CAN UDERSTAND VERY WELL.EASY TO READ.

Instelling
Vak

Voorbeeld van de inhoud

UNIT-I
OBJECT ORIENTED THINKING

Q. EXPLAIN ABOUT THE DIFFERENT PARADIGMS FOR
PROBLEM SOLVING
Paradigm definition
A paradigm is a way in which a problem is to be solved.

Evolution of Paradigms
Since the invention of computers, many programming approaches have been
developed. The primary motivation of doing so is to handle the increasing complexity of
programs and to make them reliable and maintainable.

The following are the different paradigms for problem solving,
1. Monolithic programming
 The Monolithic programming paradigm is the oldest.
 It is also known as the imperative programming paradigm.
 The program is written with a single function. A program is not divided into parts
i.e. statements are written in sequence.
 When the program size increases it failed to show the desired result in terms of bug
free, easy to maintain and reusable programs.
 The program control is achieved through the use of jumps i.e. goto statements
 It uses all data as global data which leads to data insecurity.
 This approach is useful for designing small and simple programs.
 Example: ASSEMBLY and BASIC.

2. Structured Oriented Programming
 This paradigm introduces a modular programming concept where a larger program
is divided into smaller modules.
 It also provides flow control statements that provide more control to the user.
 It uses all data as global data which leads to data insecurity.
 Example: ALGOL, Pascal, PL/I and Ada.

3. Procedure Oriented Programming
 It basically consists of writing a list of instructions and then breaking them down and
then organizing these instructions into manageable segments or groups known as
functions.
 In this, the problem is viewed as a sequence of things to be done such as reading,
calculating and printing. A number of functions are written to accomplish these
tasks.




1

,  In a multi function program, many important data items are placed as global so that
they may be accessed by all the functions. Each function may have its local data.




 Examples: C, visual basic, FORTRAN, etc.

Drawbacks
 Global data are more vulnerable to an accidental change by a function.
 In a large program it is very difficult to identify what data is used by which function.
This provides an opportunity for bugs to creep in.
 It does not model real world problems very well. This is because functions are action
oriented and do not really corresponding to the elements of the problem.

Characteristics
 Emphasis is on doing things (algorithms).
 Large programs are divided into smaller programs known as functions.
 Most of the functions share global data.
 Data move openly around the system from function to function.
 Functions transform data from one form to another.
 Employs top·down approach in program design.

4. Object Oriented Programming
 This is the most recent concept among programming paradigms.
 It is an approach that provides a way of modularizing programs by creating
partitioned memory area for both data and functions that can be used as template for
creating copies of such modules on demand.
 The major motivating factor in the invention of object oriented approach is to remove
some of the flaws encountered in the procedural approach.




2

,  Example: Smalltalk, C++, Java, C#, Python, etc.
Features
 Emphasis is on data rather than procedure.
 Programs are divided into what are known as objects.
 Data structures are designed such that they characterize the objects.
 Functions that operate on the data of an object are tied together in the data structure.
 Data is hidden and cannot be accessed by external functions.
 Objects may communicate with each other through functions.
 New data and functions can be easily added whenever necessary.
 Follows bottom-up approach in program design.

Q. WRITE THE NEED FOR STUDING OBJECT-ORIENTED
PARADIGM
 It produces reusable code because of encapsulation and inheritance.
 It promotes efficient design and development of software systems using reusable
components that can be quickly and safely assembled into larger systems.
 The code produced is likely to contain fewer errors because pretested objects are being
used.
 Less maintenance effort will be required by the developer because objects can be reused.
 The data is protected because it can be altered only by the encapsulated methods.
 The storage structure and/or procedures within an object type could be altered if required
without affecting programs that make use of that object type.
 New functions can easily be added to objects by using inheritance.

Q. DIFFERENCIATE BETWEEN OBJECT ORIENTED
PROGRAMMING AND PROCEDURE ORIENTED
PROGRAMMING
S.NO Object oriented Programming Procedure Oriented Programming

1 Emphasis is on data Emphasis is on doing things

2 Programs are divided into Objects Programs are divided into Functions

3 Employs Bottom up approach Employs Top down approach


3

, 4 Modification potential is high Modification potential is low
Data is hidden and cannot be accessed by Data is open and can be accessed by any
5
external functions functions
6 Suitable for solving big problems Not Suitable for solving big problems

7 It needs more memory than POP It needs less memory
Supports Polymorphism, Inheritance, Does not supports Polymorphism,
8
abstraction and Encapsulation Inheritance, abstraction and Encapsulation
Example languages are C,VB,FORTRAN,
9 Example languages are C++, Java
COBOL




Q. WRITE A BRIEF NOTE ON THE FOUR OOP CONCEPTS
1. 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 a list of abstract attributes
such as size, weight and cost and functions to operate on these attributes.
 They encapsulate all the essential properties of the objects that are to be created.
 The attributes are sometimes called data numbers because they hold information.
 The functions that operate on these data are sometimes called methods or member
functions.
 Since the classes use the concept of data abstraction, they are known as Abstract Data
Types (ADT).

2. Encapsulation
 Encapsulation is the mechanism that binds together code and the data it manipulates,
and keeps both safe from outside interference and misuse.
 In an object-oriented language, code and data may be combined in such a way that a
self-contained "black box" is created.
 When code and data are linked together in this fashion, an object is created. In other
words, an object is the device that supports encapsulation.
 Within an object, code, data, or both may be private to that object or public.
 Private code or data is known to and accessible only by another part of the object.
That is, private code or data may not be accessed by a piece of the program that exists
outside the object.
 When code or data is public, other parts of your program may access it even though it
is defined within an object. Typically, the public parts of an object are used to provide
a controlled interface to the private elements of the object.

3. Polymorphism
 Object-oriented programming languages support polymorphism, which is
characterized by the phrase "one interface, multiple methods."
 In simple terms, polymorphism is the attribute that allows one interface to control
access to a general class of actions. The specific action selected is determined by the
exact nature of the situation.
4

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
4 maart 2023
Aantal pagina's
222
Geschreven in
2022/2023
Type
College aantekeningen
Docent(en)
Anusha
Bevat
Alle colleges

Onderwerpen

$8.79
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
anjivarun2002

Maak kennis met de verkoper

Seller avatar
anjivarun2002 jntuh
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 jaar
Aantal volgers
0
Documenten
1
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen