CPP

27
364 reads

February 12, 2013

Copy Constructor


This code shows a class integer which contains two int data members. The class contains a constructor, which is parameterized constructor, and a copy constructor.

30
330 reads

February 12, 2013

Parameterized Constructor


This code shows a class integer which contains two int data members. The class contains a constructor, which is parameterized constructor.

35
316 reads

February 12, 2013

Default Constructor and Destructor


This code shows a class integer which contains two int data members. The class contains a constructor, which is default constructor. It is called when an object of a class is created.

38
362 reads

February 12, 2013

Destructor


Destructors are usually used to de-allocate memory and do other cleanup for a class object and its class members when the object is destroyed.

60
1602 reads

February 12, 2013

String Comparison


The string function strcmp() compares two strings, character by character. It accepts two strings as parameters and returns an integer, whose value is

38
295 reads

February 12, 2013

parameterized constructor


Parameterized constructors are one that accepts the arguments.

32
456 reads

February 12, 2013

Non parameterized constructor


Non parameterized constructor is one which takes no arguments.

43
1681 reads

February 12, 2013

String Concatenation


The string function strcat() concatenates two strings resulting in a single string. It takes two arguments, which are the destination and source strings.

382
3061 reads

February 12, 2013

Strings as an Array


C-style character string is actually a one-dimensional array of characters which is terminated by a null character '\0'.

125
1593 reads

February 12, 2013

Calling Function With Arrays


When an array arguement is passed to a function, only the address of the array gets passed, not a copy of the entire array.