Categories
: C & C++ (103)
Articles [C & C++]
Class is a key feature in C++. It makes programming much easier. To implement the class we need to create objects for that class. So, let's start with 'what is a class and an object?'
Class: Class is basically a template of variables and member...
DYNAMIC MEMORY ALLOCATION:
Dynamic memory allocation is the means by which a program can obtain memory while it is running. Global variables are allocated storage at compile time. Nonstatic , local variables use the stack. However, niether global...
This is a technique to sort a given array in an acending order.
Here is the steps we follow while performing quick sort :-
The last element of array is assumed to be "infinity".
" i " (which is an integer type variable) point to the lowest...
When objects are declared that is constructed for a particular class then this objects will occupy certain memory locations. The data members of these objects will have garbage values. In object oriented applications we will prefer that this values...
Develop a class to represent complex number. The class should have following member function.
A fn to get the CN from user.
A fn to display the CN
A fn to add the two CN which are accepted as parameters.
Multiply
Subtract
Divide
...
Friend function:-
The concept of friend function goes against the concept of date hiding.
The friend function is declared within the class and it is defined outside of the class.
The friend function is not a member function of the...
Encapsulation:
Defining data members and member functions together within a class is refffered as encapsulation. Without encapsulation the object oriented programming cannot be implement.
Data hiding:
In object oriented programming most of...
Introduction to structures :-
1) The c + + allows us to create our own data type. Due to this facility, programmer can create his or her own data type for a specific application.
2) A structure is nothing but group of data elements, which can be...
Function with default parameters (arguments)
Or
Function with parameters having default values
Consider the following program.
# include
void main ( )
{
void disptime ( int = 8, int = 0, int = 0 );
disptime (,29,39);
disptime...
Objects and Classes
Introduction:-
In c language we can define our own datatypes using structures. Therefore it is possible to develop application oriented datatype. We can define data elements as members of structure in c. However c do not...
Powered by CjBlog