SlideShare una empresa de Scribd logo
1 de 48
UNIT -I
OBJECT ORIENTED PARADIGM
 Why new Programming paradigms?
 Features of Object oriented paradigm.
“Object oriented programming is designed around the
data being operated upon as opposed to the
operations themselves.”
Workstep %
Requirements 3
Design 8
Programming 7
Testing 15
Maintenance 67
 Encapsulation: It is a mechanism that associates the
code and the data it manipulates into a single unit.
 Data Abstraction: The technique of creating new
data types that are well suited to an application to be
programmed.
 Inheritance: It allows the extension and reuse of
existing code without having to rewrite the code from
scratch.
 Multiple Inheritance: The mechanism by which a
class is derived from more than one base classes.
 Polymorphism: It allows single name/ operator to be
associated with different operations depending on the
type of data passed to it.
 Message passing: It is the process of invoking an
operation on an object.
 Extensibility: It is the feature, which allows the
extension of the existing software components.
 Persistence : The phenomenon where the object(
data) outlives the program execution time and exists
between executions of the program.
 Delegation: An alternative to class inheritance.
 Genericity: It is a technique for defining software
components that have more than one interpretation
depending on the data type of parameters.
Elements of Object oriented
programming.
 Object oriented programming is centered around new
concepts such as objects , classes, polymorphism,
inheritance etc.
 It is best suited for:
 Modeling real world problem as close as possible to the
user’s perspective.
 Constructing reusable software components and easily
extendable libraries.
 Easily modifying and extending implementations of
components without having to recode .
 “OOP is a method of implementation in which
programs are organized as co-operative
collections of objects, each of which represents an
instance of some class and whose classes are all
members of a hierarchy of classes united through
the property called inheritance.”
Grady Booch.
Objects
 Entities which have some physical or conceptual
boundaries that separate them from the rest of the
problem.
.
Merits and Demerits of OO
Methodology
Easy to trap existing pattern of human thought into
programming.
Greater modularity
The independence of each object eases the development
and maintenance of the program.
Information hiding and data abstraction increase
reliability .
Many OO languages provide a standard class library that
can be extended by the users.
 Disadvantages:
 Compiler overhead
 Runtime overhead
 Re-orientation of software developer to object oriented
thinking.
 Requires mastery over the following areas
 Software Engineering
 Programming methodologies
 Benefits only in the long run while managing large software
projects .
 Hello World
 Output Streams
 cout<<variable;
 << is called the insertion operator.
 Input streams
 cin>>variable
 >> is called the extraction operator
Literals –constant Qualifiers
 Literals are constants, to which symbolic names are
associated for the purpose of readability.
 Three ways of defining constants
 #define
 Enumerated data types
 const keyword.
.
 Scope resolution variable ::
 Scope resolution operator permits a program to
reference an identifier in the global scope that has
been hidden by another identifier with same name in
the local scope.
 Example
 Variable Definition at point of use:
 for( int i =1;i<10; i++)
Variable Aliases – Reference
Variables.
 Datatype & ReferenceVariable = ValueVariable;
 Example
Inline Functions
 inline returntype functionname(parameters)
 {
 //body of the main function
 }
 Example
Function Overloading
 Two or more functions can be given same names
provided they have different signatures.
 swap(int, int);
 swap( float, float);
 .
Default arguments
 In C++ function call, when one or more of the
arguments are omitted, the function may be defined to
take default value for the omitted arguments by
providing the default value in the function prototype.
 Example
.
Write a program to calculate simple interest using a
function which takes default argument for rate of
interest as 10%.
Format the output as follows
---------------------------------------------------------------
PRINCIPAL AMOUNT YEAR RATE INTEREST
----------------------------------------------------------------
XXXXXXX XXXXXX XXXX XX XXXXXX
----------------------------------------------------------------
Use inline function to draw the required lines.
Data Types and Sizes
 Primary
 Derived data types
 User- defined data types
 Qualifiers- Size
 Sign
 sizeof operator
 Relational operator, Logical Operator
 Bitwise operator
 Conditional Operator(Ternary Operator)
 Expression?epxression2 :expression3
 Typedef statement
 Constants
 Integer constant – Octal , Decimal, Hexadecimal
 Character constants ‘A’ and “A”
 Enumerated data type:
 An enumerated data type is a user defined type with
values ranging over a finite set of identification called
enumeration constants.
 enum color(red, blue, green);
 Example
Control Flow
 Branching Statements
 If statement
 If- else
 Switch
 goto
 Looping Statements
 For
 While
 Do - while
 break statement
 conitnue statement
Arrays and strings
 An array is a group of logically related data items of the
same data type addressed by a common name and
stored in contiguous memory locations.
 Multi dimensional array s
 A multi dimensional array is defined as follows
 Datatype array name[s1][s2]…..[sn]
 Ex: int marks[4][3]
 .
.
 Array initializations
 Int a[3][3] = {
{ 2, 3, 1},
{4, 3, 1},
{3,4, 3} };
Strings
 Strings are used to store and manipulate text. It is
represented as an array of characters and the end of
the string is marked by the NULL (‘0’) character.
 Initialization
 Char name[] ={‘s’, ’a’, ‘m’, ’0’};
 Char name[] =“sam”;
String manipulators
 strlen();
 strcpy(destination, source);
 strcat();
 strcmp();
 <0 first string is less than the second
 ==0 equal
 >0 first string is greater than the second.
 Strupr(string);
 strlwr(string);
Functions
 Function prototype:
 It provides the following information to the compiler
 The name of the function
 The type of the value returned
 The number and types of the arguments that must be
supplied to call the function.
Function definition
 The function itself is referred to as function
definition.
 The first line is known as function declarator and the
is followed by the function body.
Parameter passing
 Parameter passing is a mechanism for communication
of data and information between the calling function
(caller) and the called function(callee).
 C++ Supports the three types of parameter passing
schemes.
 Pass by value
 Pass by Address
 Pass by reference
Function Templates
 Example
Recursive function
 A function that contains a function call to itself or a
function call to a second function which eventually
calls the first function is called as recursive function.
 Two conditions which must be satisfied by any
recursive function are:
 Each time a function calls itself it must be nearer , in
some sense to a solution.
 There must be decision criterion for stopping the
process or computation.
 Example
Function and arrays
 Example
 Arrays can be passed to function by address or by
reference.
Storage Classes
 The period of time during which memory is associated
with a variable is called the extent of the variable and
is characterized by storage classes.
 Types of storage classes
 auto
 register
 extern
 static
 Storageclass datatype variable1…
 auto Variables
 By default all the variables are defined as auto variables.
 They are created when the function / block is entered
and destroyed when the function/ block is terminated.
 Register variable
 The allocation of CPU registers to variables , speeds up
the execution of the program.
 Memory is not referred when such variables are
accessed.
 No of variables which can be declared as register are
limited.
 Faster execution
Example
static variables
 The static storage class allows to define a variable
whose scope is restricted to either a block , a function
or a file and extent is the life span of the program.
 Example
Extern variables
 When a program spans across different files, they can
share information using global variables .
 Global variables are one defined and can be accessed
by all others.
 It can be achieved by declaring such variables as extern
 .
Pointers
 Pointer variable contain memory addresses as their
values.
 int *countPtr;
 double *xptr;
 Pointer Operations
 int y =5;
 int *yptr ;
 yptr = &y;
yptr 5
y
60000 5
y
yptr
50000 60000
Void pointers
 void *vptr;
 int * intptr;
 int invar;
 Char chvar;
 float flvar;
 vptr = &invar;
 vptr = &chvar;
 vptr = &flvar;
 intpr = &invar;
 Intpr= &chvar; //invalid
Using the const Qualifier with
Pointers.
 The const qualifier informs the compiler that the value of a
particular variable should not be modified.
 Non constant pointer to constant data
 const int *
 Example
 Constant pointer:
 A constant pointer to a nonconstant data is a pointer
that always points to the same memory location and the
data can be modified through pointer.
 Example
 Example2

Más contenido relacionado

La actualidad más candente

C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
Zafor Iqbal
 
Chapter 2 basic element of programming
Chapter 2 basic element of programming Chapter 2 basic element of programming
Chapter 2 basic element of programming
Zul Aiman
 

La actualidad más candente (20)

VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Advance topics of C language
Advance  topics of C languageAdvance  topics of C language
Advance topics of C language
 
C++ programing lanuage
C++ programing lanuageC++ programing lanuage
C++ programing lanuage
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1358 33 powerpoint-slides_1-introduction-c_chapter-1
358 33 powerpoint-slides_1-introduction-c_chapter-1
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
 
4. function
4. function4. function
4. function
 
1 puc programming using c++
1 puc programming using c++1 puc programming using c++
1 puc programming using c++
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 
មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++មេរៀនៈ Data Structure and Algorithm in C/C++
មេរៀនៈ Data Structure and Algorithm in C/C++
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Run time storage
Run time storageRun time storage
Run time storage
 
structured programming
structured programmingstructured programming
structured programming
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6
 
Programming in C Session 1
Programming in C Session 1Programming in C Session 1
Programming in C Session 1
 
Chapter 2 basic element of programming
Chapter 2 basic element of programming Chapter 2 basic element of programming
Chapter 2 basic element of programming
 
10. sub program
10. sub program10. sub program
10. sub program
 

Destacado

A Look Inside the Labs
A Look Inside the LabsA Look Inside the Labs
A Look Inside the Labs
guest13c69c
 
Digital vs. digitized content
Digital vs. digitized contentDigital vs. digitized content
Digital vs. digitized content
Nondas Syrrakos
 
TargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
TargetSummit Moscow Meetup | Sberbank, Polina GuschenkovaTargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
TargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
TargetSummit
 
Dgcsa teoría cuantitativa er de spence
Dgcsa teoría cuantitativa er de spenceDgcsa teoría cuantitativa er de spence
Dgcsa teoría cuantitativa er de spence
vvelasquez1004
 

Destacado (20)

Allan Borja CV
Allan Borja CVAllan Borja CV
Allan Borja CV
 
Lapis - Un progetto di Apulian ICT Living Labs
Lapis - Un progetto di Apulian ICT Living LabsLapis - Un progetto di Apulian ICT Living Labs
Lapis - Un progetto di Apulian ICT Living Labs
 
A Look Inside the Labs
A Look Inside the LabsA Look Inside the Labs
A Look Inside the Labs
 
TargetSummit Moscow Late 2016 | Peakmediation, Jordan Satok
TargetSummit Moscow Late 2016 | Peakmediation, Jordan SatokTargetSummit Moscow Late 2016 | Peakmediation, Jordan Satok
TargetSummit Moscow Late 2016 | Peakmediation, Jordan Satok
 
Application of ICT for CWSN in School Library
Application of ICT for CWSN in School Library Application of ICT for CWSN in School Library
Application of ICT for CWSN in School Library
 
Nutricion geriatrica
Nutricion geriatricaNutricion geriatrica
Nutricion geriatrica
 
Easymarket- Bando “Aiuti agli Investimenti in Ricerca per le PMI” Regione Pu...
Easymarket- Bando “Aiuti agli Investimenti in Ricerca  per le PMI” Regione Pu...Easymarket- Bando “Aiuti agli Investimenti in Ricerca  per le PMI” Regione Pu...
Easymarket- Bando “Aiuti agli Investimenti in Ricerca per le PMI” Regione Pu...
 
Plan actividades año 2015 por departamentos
Plan actividades año 2015 por departamentosPlan actividades año 2015 por departamentos
Plan actividades año 2015 por departamentos
 
Strategies to overcome the Adoption Dilemma
Strategies to overcome the Adoption DilemmaStrategies to overcome the Adoption Dilemma
Strategies to overcome the Adoption Dilemma
 
Assetto - Un progetto di Apulian ICT Living Labs
Assetto - Un progetto di Apulian ICT Living LabsAssetto - Un progetto di Apulian ICT Living Labs
Assetto - Un progetto di Apulian ICT Living Labs
 
Digital vs. digitized content
Digital vs. digitized contentDigital vs. digitized content
Digital vs. digitized content
 
Assaad khalid khan c.v
Assaad khalid khan c.vAssaad khalid khan c.v
Assaad khalid khan c.v
 
TargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
TargetSummit Moscow Meetup | Sberbank, Polina GuschenkovaTargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
TargetSummit Moscow Meetup | Sberbank, Polina Guschenkova
 
詹姆士看天下 2015/12/21
詹姆士看天下 2015/12/21詹姆士看天下 2015/12/21
詹姆士看天下 2015/12/21
 
Solid waste management of warangal city
Solid waste management of warangal citySolid waste management of warangal city
Solid waste management of warangal city
 
Dgcsa teoría cuantitativa er de spence
Dgcsa teoría cuantitativa er de spenceDgcsa teoría cuantitativa er de spence
Dgcsa teoría cuantitativa er de spence
 
IULM Social media Project Work
IULM Social media Project WorkIULM Social media Project Work
IULM Social media Project Work
 
Sodias
SodiasSodias
Sodias
 
Enviornmentally controlled houses for broiler production
Enviornmentally controlled houses for broiler productionEnviornmentally controlled houses for broiler production
Enviornmentally controlled houses for broiler production
 
La sezione Riepilogo nel Profilo LinkedIn
La sezione Riepilogo nel Profilo LinkedInLa sezione Riepilogo nel Profilo LinkedIn
La sezione Riepilogo nel Profilo LinkedIn
 

Similar a Unit 1

Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
urvashipundir04
 
379008-rc217-functionalprogramming
379008-rc217-functionalprogramming379008-rc217-functionalprogramming
379008-rc217-functionalprogramming
Luis Atencio
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
lienhard
 

Similar a Unit 1 (20)

Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
Unit 2
Unit 2Unit 2
Unit 2
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Question bank unit i
Question bank unit iQuestion bank unit i
Question bank unit i
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
379008-rc217-functionalprogramming
379008-rc217-functionalprogramming379008-rc217-functionalprogramming
379008-rc217-functionalprogramming
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
Monolithic and Procedural Programming
Monolithic and Procedural ProgrammingMonolithic and Procedural Programming
Monolithic and Procedural Programming
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
My c++
My c++My c++
My c++
 
Programming in C.docx
Programming in C.docxProgramming in C.docx
Programming in C.docx
 

Más de donny101 (9)

Unit v
Unit vUnit v
Unit v
 
Unit iv
Unit ivUnit iv
Unit iv
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Unit ii
Unit   iiUnit   ii
Unit ii
 
Unit vos - File systems
Unit vos - File systemsUnit vos - File systems
Unit vos - File systems
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
Unit iios process scheduling and synchronization
Unit iios process scheduling and synchronizationUnit iios process scheduling and synchronization
Unit iios process scheduling and synchronization
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Management
 
Unit 1os processes and threads
Unit 1os processes and threadsUnit 1os processes and threads
Unit 1os processes and threads
 

Último

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Último (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 

Unit 1

  • 2. OBJECT ORIENTED PARADIGM  Why new Programming paradigms?  Features of Object oriented paradigm. “Object oriented programming is designed around the data being operated upon as opposed to the operations themselves.” Workstep % Requirements 3 Design 8 Programming 7 Testing 15 Maintenance 67
  • 3.
  • 4.  Encapsulation: It is a mechanism that associates the code and the data it manipulates into a single unit.  Data Abstraction: The technique of creating new data types that are well suited to an application to be programmed.  Inheritance: It allows the extension and reuse of existing code without having to rewrite the code from scratch.  Multiple Inheritance: The mechanism by which a class is derived from more than one base classes.
  • 5.  Polymorphism: It allows single name/ operator to be associated with different operations depending on the type of data passed to it.  Message passing: It is the process of invoking an operation on an object.  Extensibility: It is the feature, which allows the extension of the existing software components.  Persistence : The phenomenon where the object( data) outlives the program execution time and exists between executions of the program.  Delegation: An alternative to class inheritance.  Genericity: It is a technique for defining software components that have more than one interpretation depending on the data type of parameters.
  • 6. Elements of Object oriented programming.  Object oriented programming is centered around new concepts such as objects , classes, polymorphism, inheritance etc.  It is best suited for:  Modeling real world problem as close as possible to the user’s perspective.  Constructing reusable software components and easily extendable libraries.  Easily modifying and extending implementations of components without having to recode .
  • 7.  “OOP is a method of implementation in which programs are organized as co-operative collections of objects, each of which represents an instance of some class and whose classes are all members of a hierarchy of classes united through the property called inheritance.” Grady Booch.
  • 8. Objects  Entities which have some physical or conceptual boundaries that separate them from the rest of the problem.
  • 9.
  • 10.
  • 11. .
  • 12. Merits and Demerits of OO Methodology Easy to trap existing pattern of human thought into programming. Greater modularity The independence of each object eases the development and maintenance of the program. Information hiding and data abstraction increase reliability . Many OO languages provide a standard class library that can be extended by the users.
  • 13.  Disadvantages:  Compiler overhead  Runtime overhead  Re-orientation of software developer to object oriented thinking.  Requires mastery over the following areas  Software Engineering  Programming methodologies  Benefits only in the long run while managing large software projects .
  • 14.  Hello World  Output Streams  cout<<variable;  << is called the insertion operator.  Input streams  cin>>variable  >> is called the extraction operator
  • 15. Literals –constant Qualifiers  Literals are constants, to which symbolic names are associated for the purpose of readability.  Three ways of defining constants  #define  Enumerated data types  const keyword.
  • 16. .  Scope resolution variable ::  Scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with same name in the local scope.  Example  Variable Definition at point of use:  for( int i =1;i<10; i++)
  • 17. Variable Aliases – Reference Variables.  Datatype & ReferenceVariable = ValueVariable;  Example
  • 18. Inline Functions  inline returntype functionname(parameters)  {  //body of the main function  }  Example
  • 19. Function Overloading  Two or more functions can be given same names provided they have different signatures.  swap(int, int);  swap( float, float);
  • 20.  .
  • 21. Default arguments  In C++ function call, when one or more of the arguments are omitted, the function may be defined to take default value for the omitted arguments by providing the default value in the function prototype.  Example
  • 22. . Write a program to calculate simple interest using a function which takes default argument for rate of interest as 10%. Format the output as follows --------------------------------------------------------------- PRINCIPAL AMOUNT YEAR RATE INTEREST ---------------------------------------------------------------- XXXXXXX XXXXXX XXXX XX XXXXXX ---------------------------------------------------------------- Use inline function to draw the required lines.
  • 23. Data Types and Sizes  Primary  Derived data types  User- defined data types  Qualifiers- Size  Sign  sizeof operator  Relational operator, Logical Operator  Bitwise operator  Conditional Operator(Ternary Operator)  Expression?epxression2 :expression3  Typedef statement
  • 24.  Constants  Integer constant – Octal , Decimal, Hexadecimal  Character constants ‘A’ and “A”  Enumerated data type:  An enumerated data type is a user defined type with values ranging over a finite set of identification called enumeration constants.  enum color(red, blue, green);  Example
  • 25. Control Flow  Branching Statements  If statement  If- else  Switch  goto  Looping Statements  For  While  Do - while
  • 26.  break statement  conitnue statement
  • 27. Arrays and strings  An array is a group of logically related data items of the same data type addressed by a common name and stored in contiguous memory locations.  Multi dimensional array s  A multi dimensional array is defined as follows  Datatype array name[s1][s2]…..[sn]  Ex: int marks[4][3]
  • 28.  .
  • 29. .  Array initializations  Int a[3][3] = { { 2, 3, 1}, {4, 3, 1}, {3,4, 3} };
  • 30. Strings  Strings are used to store and manipulate text. It is represented as an array of characters and the end of the string is marked by the NULL (‘0’) character.  Initialization  Char name[] ={‘s’, ’a’, ‘m’, ’0’};  Char name[] =“sam”;
  • 31. String manipulators  strlen();  strcpy(destination, source);  strcat();  strcmp();  <0 first string is less than the second  ==0 equal  >0 first string is greater than the second.  Strupr(string);  strlwr(string);
  • 33.  Function prototype:  It provides the following information to the compiler  The name of the function  The type of the value returned  The number and types of the arguments that must be supplied to call the function.
  • 34. Function definition  The function itself is referred to as function definition.  The first line is known as function declarator and the is followed by the function body.
  • 35. Parameter passing  Parameter passing is a mechanism for communication of data and information between the calling function (caller) and the called function(callee).  C++ Supports the three types of parameter passing schemes.  Pass by value  Pass by Address  Pass by reference
  • 37. Recursive function  A function that contains a function call to itself or a function call to a second function which eventually calls the first function is called as recursive function.  Two conditions which must be satisfied by any recursive function are:  Each time a function calls itself it must be nearer , in some sense to a solution.  There must be decision criterion for stopping the process or computation.  Example
  • 38. Function and arrays  Example  Arrays can be passed to function by address or by reference.
  • 39. Storage Classes  The period of time during which memory is associated with a variable is called the extent of the variable and is characterized by storage classes.  Types of storage classes  auto  register  extern  static
  • 40.  Storageclass datatype variable1…  auto Variables  By default all the variables are defined as auto variables.  They are created when the function / block is entered and destroyed when the function/ block is terminated.
  • 41.  Register variable  The allocation of CPU registers to variables , speeds up the execution of the program.  Memory is not referred when such variables are accessed.  No of variables which can be declared as register are limited.  Faster execution Example
  • 42. static variables  The static storage class allows to define a variable whose scope is restricted to either a block , a function or a file and extent is the life span of the program.  Example
  • 43. Extern variables  When a program spans across different files, they can share information using global variables .  Global variables are one defined and can be accessed by all others.  It can be achieved by declaring such variables as extern
  • 44.  .
  • 45. Pointers  Pointer variable contain memory addresses as their values.  int *countPtr;  double *xptr;  Pointer Operations  int y =5;  int *yptr ;  yptr = &y; yptr 5 y 60000 5 y yptr 50000 60000
  • 46. Void pointers  void *vptr;  int * intptr;  int invar;  Char chvar;  float flvar;  vptr = &invar;  vptr = &chvar;  vptr = &flvar;  intpr = &invar;  Intpr= &chvar; //invalid
  • 47.
  • 48. Using the const Qualifier with Pointers.  The const qualifier informs the compiler that the value of a particular variable should not be modified.  Non constant pointer to constant data  const int *  Example  Constant pointer:  A constant pointer to a nonconstant data is a pointer that always points to the same memory location and the data can be modified through pointer.  Example  Example2