CPP

38
2096 reads

February 7, 2013

Bad Allocation Exception


It is recommended to include all dynamic memory allocations within a try block that catches this type of exception to perform a clean action instead of an abnormal program termination, which is what h

345
4060 reads

February 7, 2013

Passing arguments by Reference


Passing by reference refers to a method of passing arguments where the value of an argument in the calling function can be modified in the called function.

399
3956 reads

February 7, 2013

Functions - Passing arguments by Value


Passing arguments by value copies the actual value of an argument into the formal parameter of the function.

344
3848 reads

February 7, 2013

Simple Functions


A function is a group of statements that together perform a task. Every C++ program has at least one function called main().

64
335 reads

February 6, 2013

Product of two numbers using member function


This program demonstrates calculating the product of 2 numbers with the help of a member function.

95
939 reads

February 6, 2013

Swapping two numbers


This example demonstrates the logic to swap 2 numbers.

31
345 reads

February 6, 2013

Sum of two numbers using Inline Method


The program declares a class myClass containing two numbers a and b and a number res for storing the result.

298
2950 reads

February 6, 2013

Function Overloading


Function overloading or method overloading allows creating several methods with the same name which differ from each other in the type of the inputs.

27
358 reads

February 6, 2013

Inline Functions


Inline functions is an optimization technique used by compilers.
One needs to simply write the "inline" keyword in the prefix of the function prototype to make a function inline.

228
1698 reads

February 6, 2013

Reference parameters


In call-by-reference evaluation (also referred to as pass-by-reference), a function receives an implicit reference to a variable used as argument, rather than a copy of its value.