SlideShare a Scribd company logo
TRINITY INSTITUTE OF PROFESSIONAL
STUDIESSector – 9, DwarkaInstitutional Area, New Delhi-75
Affiliated Institution of G.G.S.IP.U, Delhi
Object Oriented Programming
using C++
Paper ID : 20209
Course : BCA
InlineFuntions
By HimjaSethi
Asstt. Prof. (IT)
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Inline Functions
• A function in C++ can be treated as a macro if
the
keyword inline precedes its definition
• Syntax of representing inline function:
inline ReturnType
FunctionName(Parameters)
{
// body of the main function
}
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Syntax : Inline Function
Function to find square of a number :
inline float square(float x)
{
x = x* x;
return (x);
}
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Advantages: Inline Functions
• There is no explicit function call; the function body is
substituted at the point of inline function call
• Runtime overhead for function linkage mechanism is
reduced.
• The execution time of the function square() is less
than the time required to establish a linkage
between the function caller and the callee.
• Inline functions provide flexibility and benefits of
modular programming.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Advantages : Inline Functions
• Inline functions provide flexibility and benefits of
modular programming.
• Provide computational speedups of macros.
• It is advisable to define functions having small body
as inline functions.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Sample Program
#include <iostream.h>
inline float square(float x)
{
x = x* x;
return (x);
}
void main()
{
float num;
cout<<“ Enter a number <float>”;
cin>>num;
cout<< “Its square = “ << square (num);
}
Gets replaced by the instructions
of square() function body by
compiler
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Outside Member Functions as Inline
• Member functions declared outside the class
declaration can be made inline by prefixing
the inline to its definition as shown:
inline ReturnType
ClassName::MemberFunctionName(Argument
s )
{
…
}
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
When to use inline Functions
• In general, inline functions should not be used
• If a fully developed and tested program runs too slowly and
shows bottlenecks in certain functions then it can be
considered to use inline functions. A profiler ( which runs the
program and determines where most of the execution time is
spent) can be used in deciding such an optimization.
• When member functions consist of one very simple
statement such as the return statement in the example
below:
inline int date :: getday()
{
return day;
}
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
When to use inline Functions
• It is only useful to implement an inline function if the
time spent during a function call is more compared to
the function body execution time. An example where
an inline function has no effect at all is the following:
inline void date :: show()
{
cout << day << “ –” << month<< “-” << year << endl;
}
The above function takes relatively longer time to execute.
The effect of conversion of the function show() to inline
would
lead to reduction in execution time.
TRINITY INSTITUTE OF PROFESSIONAL STUDIES
Sector – 9, DwarkaInstitutional Area, New Delhi-75
Disadvantage of Inline Function
• The actual code is inserted by the compiler
and therefore it should be known at the
compile time. Hence, an inline function can
not be located in a run-time library.
Ad

More Related Content

Similar to Object oriented programming using c++ (20)

Classes and objects
Classes and objectsClasses and objects
Classes and objects
Nilesh Dalvi
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Trinity Dwarka
 
Java programming
Java programmingJava programming
Java programming
Trinity Dwarka
 
web technology presentation by faraz khan.pptx
web technology presentation by  faraz khan.pptxweb technology presentation by  faraz khan.pptx
web technology presentation by faraz khan.pptx
seriousreviews
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
Muhammed Thanveer M
 
Object Oriented Programming using C++ Unit 1
Object Oriented Programming using C++ Unit 1Object Oriented Programming using C++ Unit 1
Object Oriented Programming using C++ Unit 1
NageshPratapSingh2
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
Aadil Ansari
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
Maaz Hasan
 
OOP in java
OOP in javaOOP in java
OOP in java
baabtra.com - No. 1 supplier of quality freshers
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
Soba Arjun
 
Bsc. Csit Final Year Internship Presentation
Bsc. Csit Final Year Internship PresentationBsc. Csit Final Year Internship Presentation
Bsc. Csit Final Year Internship Presentation
Dark Shadow
 
Introduction to Programming Language using C
Introduction to Programming Language using CIntroduction to Programming Language using C
Introduction to Programming Language using C
Trinity Dwarka
 
4.1 Function Templates,Overlaoding Function Templates.pptx
4.1 Function Templates,Overlaoding Function Templates.pptx4.1 Function Templates,Overlaoding Function Templates.pptx
4.1 Function Templates,Overlaoding Function Templates.pptx
tirseishwaricomp
 
Software Engineering- Engineering Practice
Software Engineering- Engineering PracticeSoftware Engineering- Engineering Practice
Software Engineering- Engineering Practice
Trinity Dwarka
 
Object oriented programming using BCA 209
Object oriented programming using BCA 209Object oriented programming using BCA 209
Object oriented programming using BCA 209
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVDChapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
azimah6642
 
Resume - Sachin Kumar
Resume - Sachin KumarResume - Sachin Kumar
Resume - Sachin Kumar
Sachin Kumar
 
Software Engineering- Types of Testing
Software Engineering- Types of TestingSoftware Engineering- Types of Testing
Software Engineering- Types of Testing
Trinity Dwarka
 
Ocs752 unit 4
Ocs752   unit 4Ocs752   unit 4
Ocs752 unit 4
mgrameshmail
 
OPPS using C++
OPPS using C++ OPPS using C++
OPPS using C++
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
Nilesh Dalvi
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Trinity Dwarka
 
web technology presentation by faraz khan.pptx
web technology presentation by  faraz khan.pptxweb technology presentation by  faraz khan.pptx
web technology presentation by faraz khan.pptx
seriousreviews
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
Muhammed Thanveer M
 
Object Oriented Programming using C++ Unit 1
Object Oriented Programming using C++ Unit 1Object Oriented Programming using C++ Unit 1
Object Oriented Programming using C++ Unit 1
NageshPratapSingh2
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
Aadil Ansari
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
Maaz Hasan
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
Soba Arjun
 
Bsc. Csit Final Year Internship Presentation
Bsc. Csit Final Year Internship PresentationBsc. Csit Final Year Internship Presentation
Bsc. Csit Final Year Internship Presentation
Dark Shadow
 
Introduction to Programming Language using C
Introduction to Programming Language using CIntroduction to Programming Language using C
Introduction to Programming Language using C
Trinity Dwarka
 
4.1 Function Templates,Overlaoding Function Templates.pptx
4.1 Function Templates,Overlaoding Function Templates.pptx4.1 Function Templates,Overlaoding Function Templates.pptx
4.1 Function Templates,Overlaoding Function Templates.pptx
tirseishwaricomp
 
Software Engineering- Engineering Practice
Software Engineering- Engineering PracticeSoftware Engineering- Engineering Practice
Software Engineering- Engineering Practice
Trinity Dwarka
 
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVDChapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
Chapter 12 PJPK SDSDRFHVRCHVFHHVDRHVDRVHGVD
azimah6642
 
Resume - Sachin Kumar
Resume - Sachin KumarResume - Sachin Kumar
Resume - Sachin Kumar
Sachin Kumar
 
Software Engineering- Types of Testing
Software Engineering- Types of TestingSoftware Engineering- Types of Testing
Software Engineering- Types of Testing
Trinity Dwarka
 

More from Trinity Dwarka (20)

Why BAJMC in Trinity Dwarka
Why BAJMC in Trinity DwarkaWhy BAJMC in Trinity Dwarka
Why BAJMC in Trinity Dwarka
Trinity Dwarka
 
Career Options after BCA
Career Options after BCACareer Options after BCA
Career Options after BCA
Trinity Dwarka
 
Principles of Management-Management-Concept & Meaning
  Principles of Management-Management-Concept & Meaning  Principles of Management-Management-Concept & Meaning
Principles of Management-Management-Concept & Meaning
Trinity Dwarka
 
Principles of Management- Management Process & Functions
Principles of Management- Management Process  &  FunctionsPrinciples of Management- Management Process  &  Functions
Principles of Management- Management Process & Functions
Trinity Dwarka
 
Principles of Management- Managerial Levels & Roles-
Principles of Management- Managerial Levels & Roles-Principles of Management- Managerial Levels & Roles-
Principles of Management- Managerial Levels & Roles-
Trinity Dwarka
 
Management-Concept & Meaning
 Management-Concept & Meaning Management-Concept & Meaning
Management-Concept & Meaning
Trinity Dwarka
 
Principles of Management- Planning
Principles of Management- PlanningPrinciples of Management- Planning
Principles of Management- Planning
Trinity Dwarka
 
Organizing Authority & Responsibility- Principles of Management
Organizing Authority & Responsibility- Principles of ManagementOrganizing Authority & Responsibility- Principles of Management
Organizing Authority & Responsibility- Principles of Management
Trinity Dwarka
 
Staffing- Principles of Management
Staffing- Principles of ManagementStaffing- Principles of Management
Staffing- Principles of Management
Trinity Dwarka
 
Directing-Principles of Management
Directing-Principles of ManagementDirecting-Principles of Management
Directing-Principles of Management
Trinity Dwarka
 
Dimensional Modelling-Data Warehouse & Data Mining
 Dimensional Modelling-Data Warehouse & Data Mining Dimensional Modelling-Data Warehouse & Data Mining
Dimensional Modelling-Data Warehouse & Data Mining
Trinity Dwarka
 
Data Preprocessing- Data Warehouse & Data Mining
Data Preprocessing- Data Warehouse & Data MiningData Preprocessing- Data Warehouse & Data Mining
Data Preprocessing- Data Warehouse & Data Mining
Trinity Dwarka
 
Computer Networks- Network Basics
Computer Networks- Network BasicsComputer Networks- Network Basics
Computer Networks- Network Basics
Trinity Dwarka
 
Linux Environment- Linux vs Unix
Linux Environment- Linux vs UnixLinux Environment- Linux vs Unix
Linux Environment- Linux vs Unix
Trinity Dwarka
 
Linux Environment- Linux Basics
Linux Environment- Linux BasicsLinux Environment- Linux Basics
Linux Environment- Linux Basics
Trinity Dwarka
 
BCA-Mobile Computing- BASICS OF MOBILE COMPUTING
BCA-Mobile Computing- BASICS OF MOBILE COMPUTINGBCA-Mobile Computing- BASICS OF MOBILE COMPUTING
BCA-Mobile Computing- BASICS OF MOBILE COMPUTING
Trinity Dwarka
 
INTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
INTRODUCTION TO INFORMATION TECHNOLOGY- IT BasicsINTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
INTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
Trinity Dwarka
 
Database Management System
Database Management System Database Management System
Database Management System
Trinity Dwarka
 
JAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP ConceptJAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP Concept
Trinity Dwarka
 
E-Commerce- Introduction to E-Commerce
E-Commerce- Introduction to E-CommerceE-Commerce- Introduction to E-Commerce
E-Commerce- Introduction to E-Commerce
Trinity Dwarka
 
Why BAJMC in Trinity Dwarka
Why BAJMC in Trinity DwarkaWhy BAJMC in Trinity Dwarka
Why BAJMC in Trinity Dwarka
Trinity Dwarka
 
Career Options after BCA
Career Options after BCACareer Options after BCA
Career Options after BCA
Trinity Dwarka
 
Principles of Management-Management-Concept & Meaning
  Principles of Management-Management-Concept & Meaning  Principles of Management-Management-Concept & Meaning
Principles of Management-Management-Concept & Meaning
Trinity Dwarka
 
Principles of Management- Management Process & Functions
Principles of Management- Management Process  &  FunctionsPrinciples of Management- Management Process  &  Functions
Principles of Management- Management Process & Functions
Trinity Dwarka
 
Principles of Management- Managerial Levels & Roles-
Principles of Management- Managerial Levels & Roles-Principles of Management- Managerial Levels & Roles-
Principles of Management- Managerial Levels & Roles-
Trinity Dwarka
 
Management-Concept & Meaning
 Management-Concept & Meaning Management-Concept & Meaning
Management-Concept & Meaning
Trinity Dwarka
 
Principles of Management- Planning
Principles of Management- PlanningPrinciples of Management- Planning
Principles of Management- Planning
Trinity Dwarka
 
Organizing Authority & Responsibility- Principles of Management
Organizing Authority & Responsibility- Principles of ManagementOrganizing Authority & Responsibility- Principles of Management
Organizing Authority & Responsibility- Principles of Management
Trinity Dwarka
 
Staffing- Principles of Management
Staffing- Principles of ManagementStaffing- Principles of Management
Staffing- Principles of Management
Trinity Dwarka
 
Directing-Principles of Management
Directing-Principles of ManagementDirecting-Principles of Management
Directing-Principles of Management
Trinity Dwarka
 
Dimensional Modelling-Data Warehouse & Data Mining
 Dimensional Modelling-Data Warehouse & Data Mining Dimensional Modelling-Data Warehouse & Data Mining
Dimensional Modelling-Data Warehouse & Data Mining
Trinity Dwarka
 
Data Preprocessing- Data Warehouse & Data Mining
Data Preprocessing- Data Warehouse & Data MiningData Preprocessing- Data Warehouse & Data Mining
Data Preprocessing- Data Warehouse & Data Mining
Trinity Dwarka
 
Computer Networks- Network Basics
Computer Networks- Network BasicsComputer Networks- Network Basics
Computer Networks- Network Basics
Trinity Dwarka
 
Linux Environment- Linux vs Unix
Linux Environment- Linux vs UnixLinux Environment- Linux vs Unix
Linux Environment- Linux vs Unix
Trinity Dwarka
 
Linux Environment- Linux Basics
Linux Environment- Linux BasicsLinux Environment- Linux Basics
Linux Environment- Linux Basics
Trinity Dwarka
 
BCA-Mobile Computing- BASICS OF MOBILE COMPUTING
BCA-Mobile Computing- BASICS OF MOBILE COMPUTINGBCA-Mobile Computing- BASICS OF MOBILE COMPUTING
BCA-Mobile Computing- BASICS OF MOBILE COMPUTING
Trinity Dwarka
 
INTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
INTRODUCTION TO INFORMATION TECHNOLOGY- IT BasicsINTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
INTRODUCTION TO INFORMATION TECHNOLOGY- IT Basics
Trinity Dwarka
 
Database Management System
Database Management System Database Management System
Database Management System
Trinity Dwarka
 
JAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP ConceptJAVA PROGRAMMING- OOP Concept
JAVA PROGRAMMING- OOP Concept
Trinity Dwarka
 
E-Commerce- Introduction to E-Commerce
E-Commerce- Introduction to E-CommerceE-Commerce- Introduction to E-Commerce
E-Commerce- Introduction to E-Commerce
Trinity Dwarka
 
Ad

Recently uploaded (20)

2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Grade 3 - English - Printable Worksheet (PDF Format)
Grade 3 - English - Printable Worksheet  (PDF Format)Grade 3 - English - Printable Worksheet  (PDF Format)
Grade 3 - English - Printable Worksheet (PDF Format)
Sritoma Majumder
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
BỘ ĐỀ TUYỂN SINH VÀO LỚP 10 TIẾNG ANH - 25 ĐỀ THI BÁM SÁT CẤU TRÚC MỚI NHẤT, ...
Nguyen Thanh Tu Collection
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Ad

Object oriented programming using c++

  • 1. TRINITY INSTITUTE OF PROFESSIONAL STUDIESSector – 9, DwarkaInstitutional Area, New Delhi-75 Affiliated Institution of G.G.S.IP.U, Delhi Object Oriented Programming using C++ Paper ID : 20209 Course : BCA InlineFuntions By HimjaSethi Asstt. Prof. (IT)
  • 2. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Inline Functions • A function in C++ can be treated as a macro if the keyword inline precedes its definition • Syntax of representing inline function: inline ReturnType FunctionName(Parameters) { // body of the main function }
  • 3. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Syntax : Inline Function Function to find square of a number : inline float square(float x) { x = x* x; return (x); }
  • 4. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Advantages: Inline Functions • There is no explicit function call; the function body is substituted at the point of inline function call • Runtime overhead for function linkage mechanism is reduced. • The execution time of the function square() is less than the time required to establish a linkage between the function caller and the callee. • Inline functions provide flexibility and benefits of modular programming.
  • 5. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Advantages : Inline Functions • Inline functions provide flexibility and benefits of modular programming. • Provide computational speedups of macros. • It is advisable to define functions having small body as inline functions.
  • 6. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Sample Program #include <iostream.h> inline float square(float x) { x = x* x; return (x); } void main() { float num; cout<<“ Enter a number <float>”; cin>>num; cout<< “Its square = “ << square (num); } Gets replaced by the instructions of square() function body by compiler
  • 7. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Outside Member Functions as Inline • Member functions declared outside the class declaration can be made inline by prefixing the inline to its definition as shown: inline ReturnType ClassName::MemberFunctionName(Argument s ) { … }
  • 8. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 When to use inline Functions • In general, inline functions should not be used • If a fully developed and tested program runs too slowly and shows bottlenecks in certain functions then it can be considered to use inline functions. A profiler ( which runs the program and determines where most of the execution time is spent) can be used in deciding such an optimization. • When member functions consist of one very simple statement such as the return statement in the example below: inline int date :: getday() { return day; }
  • 9. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 When to use inline Functions • It is only useful to implement an inline function if the time spent during a function call is more compared to the function body execution time. An example where an inline function has no effect at all is the following: inline void date :: show() { cout << day << “ –” << month<< “-” << year << endl; } The above function takes relatively longer time to execute. The effect of conversion of the function show() to inline would lead to reduction in execution time.
  • 10. TRINITY INSTITUTE OF PROFESSIONAL STUDIES Sector – 9, DwarkaInstitutional Area, New Delhi-75 Disadvantage of Inline Function • The actual code is inserted by the compiler and therefore it should be known at the compile time. Hence, an inline function can not be located in a run-time library.