Unit-4 Member Function OOPs Using C++ | BCA 2nd Year
Unit-4 Member Function OOPs Using C++ | BCA 2nd Year-Hello everyone welcome to the pencilchampions.com website. This website provide BCA Unit-4 Member functions OOPs Using C and C++ BCA 3rd Semester. Thankyou for visiting pencilchampions.com website. Â
Unit- 4
Member Function
- A member function performs essential operations for the class. It can be used to read or manipulate the display data member. A class can be defined in the member
- Two spaces inside class definition, outside class definition
Read External link–https://dreamstudy.allbca.com/
Function
- Function is the statement that a group together performs a specific task. Every C++ program has at least one function that is main.
Read More-https://pencilchampions.com/unit-3-access-specifiers-oops-using-c-bca-2nd-year-2023/
Why use functions
- In calculator programs we can write separate functions for addition (sun), subtraction for every argument and subtraction (n). Any function can be called multiple times.
- Ability to re-use code. Capacity.
- Develop an application in module format.
- Easy to debug the program.
- Code optimization, no need to write ist of code.
There are two types of functions-
- Library function or pre-defined function.
- User-defined functions.
- The implementation part of the predefine function is available in library files which are library. Object files. Library or object  files contain predefined code…
Limitations of library functions
- As a programmer, we have no control over predefined functions. The implementation part is machine readable format.
- Whenever in the implementation any predefined function is not supporting the user
Necessary work.
- Then go to User Defined
User-defined functions –
- These functions. Are created by programmers as per their requirements.
- For example- Suppose you want to create a function to add two numbers then you create a function named Surm. This type goes for user defined functions.
Defining a Function
- Return Type – A value that a function can iterate over. A return type is a value that a function can iterate over. The return type parameter and return statement are optional.
- Function Name – Function declaration is the process of telling the compiler about what the function returns.
- Parameters – A paramotor is like a place holder. You pass a value when a function is invoked Parameters. This value refers to the ordered type and number of parameters of a function. Parameters are optional i.e. a function can have a number of parameters.
- Function Body – The function body contains a collection of statements that define what the function does.
- Function Declaration – Function declaration tells the compiler about the function name and how to call the function. Syntax: return type functionName(parameter),
- Calling a function – When we call a function the control goes to function 55/73 and executes the entire code.Â
Discover more from Pencil Champions
Subscribe to get the latest posts sent to your email.