5

CHAPTER

Functions in C++

CHAPTEROUTLINE —•    5.1 Introduction
—•    5.2 The main ( ) Function in C and C++
—•    5.3 Parts of Function
—•    5.4 Passing Arguments
—•    5.5 LValues and RValues
—•    5.6 Return by Reference
—•    5.7 Returning More Values by Reference
—•    5.8 Default Arguments
—•    5.9 The const Argument
—•  5.10 Inputting Default Arguments
—•  5.11 Inline Functions
—•  5.12 Function Overloading
—•  5.13 Principles of Function Overloading
—•  5.14 Precautions with Function Overloading
—•  5.15 Library Functions

5.1 INTRODUCTION

When the concept of function or sub-program was not introduced, the programs were large in size and code got repeated as shown in Figure 5.1. It was very difficult ...

Get Object-Oriented Programming with ANSI and Turbo C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.