Open Means Open Means

Friend function And Friend Class

No comments on “Friend function And Friend Class”

Friend function:-

  1. The concept of friend function goes against the concept of date hiding.
  2. The friend function is declared within the class and it is defined outside of the class.
  3. The friend function is not a member function of the class.
  4. Since friend function is not the member function of the class. It is not called for any object, rather objects are passed as parameters to it.
  5. Even if friend function is not a member function of the class. It can access private member of the class.
  6. The concept of friend function is useful when a function act as friend function of two more classes.
Program:

Consider the following example.

#include
class ABC
{
int data ;
Public:
void xyz (int) ;
void dff (int) ;
void display ( ) ;
friend void pqr ( abc &);
};
void abc :: xyz (int d)
{
data=d ;
}
void abc :: def (int d)
{
data=d ;
}
void abc :: display ( )
{
cout<
}
void pqr (abc & t)
{
t.data=5;
}
void main ( )
{
abc a ;
a.xyz (3) ;
a.display ( ) ;
a.def (4)
a.display ( ) ;
pqr (a) ;
a.display ( );
}
Explanation:-
→   In the above program the class abc defines one private data member data and it defines three public member function xyz, def and display.
→   Consider the following declarations. Friend void pqr (abc &); this declarations indicate that pqr is a function that accepts alias of object of class abc and it returns nothing.
→  The word friend indicates that it is not a member function of class ABC. The class ABC declares it as its friend function.
→  The member fn xyz, def, display are called for object a.
→  The friend fn pqr is called and object a is passed a parameter.
→  The t acts as alias of object a and the value of t data i.e a data will become 5.
→  Even if pqr is not a member function of class ABC still it can acess private datameter data of class abc. This because class abc has declared fn pqr as its friend fn
→  Suppose we write a statement a.data=6 in The main fn then error will occur this is because main is number member fn of the class ABC nor a friend of class ABC.

Program :-

 Develop a class period represented in hours and minutes. The class should have following member function.

 1)Setperiod ( ) 2) getperiod ( ) 3) display ( ) Define a fn add as a friend fn of class period .It will add two periods and should return answers of the addition.

 Write suitable main fn

 # include

class period
{
int hour, min ;
public:
void setperiod (int, int) ;
void getperiod ( ) ;
void display ( ) ;
friend period add ( period, period)
};
void period :: setperiod (int h, m)
{
hour=h ;
min=m ;
}
void period :: getperiod ( )
{
cin>>hour>>min ;
}
void period :: display ( )
{
cout<<"hour<<"hour;"<
}
period add (period x, period y)
{
period temp ;
temp.hour = x.hour + y.hour ;
temp.min = y.hour + y.hour ;
temp.min = x.min + y.min ;
if (temp.min>=60)
{
temp.min−=60 ;
temp.hour ++ ;
{
return temp ;
}
void main ( )
{
period P1,P2,P3;
P1.setperiod (2,26) ;
cout<<"Enter period in hrs and min=" ;
P2.get period ( );
P3=add (p1+p2) ;
cout<<"1st period \n" ;
p1. display ( ) ;
cout<<"2nd period\n' ;
P2.display ( ) ;
cout<<"Addition\n" ‘
P3.display ( ) ;
}
Explanation:-
In the above program add is declared as friend function by class period
Consider the statement
P3=add (P1,P2);
It indicates that friend function add is called and objects P1 and P2 are passed as parameters. Returned answer will be assigned to P3.
Even if add is not a member function of class period. It can still access private datamember of class period i.e hour and min. This is possible only because fn add acts as friend fn of class period.
Friend class:
One class can act as friend class of other class. All the member fn of the friend class can access the private members of other class.
Consider the following example:
# include
class def ;
class abc ;
{
public:
void fun 1 (def & ) ;
void fun 2 (def &) ;
void fun 3 (def &) ;
};
class def
{
int data ;
public:
void set data (int) ;
void display ( ) ;
friend class abc ;
};
void abc :: fun 1 (def & d)
{
d.data + = 5 ;
}
void abc :: fun 2 (def &d)
{
d.data *=5 ;
}
void abc :: fun 3 (def & d)
{
d.data - =5 ;
}
void def :: set data (int x)
{
data=x ;
}
void def :: display ( )
{
cout<
}
void main ( )
{
abc a1 ;
def d1 ;
d1.setdata (3) ;
d1. display ( ) ;
a1.fun 1 (d1) ;
d1. display ( ) ;
a1.fun 2 (d1) ;
d1.display ( ) ;
a1.fun 3 ( d1) ;
d1.display ( ) ;
}
Explanation:
→      In the above program fun 1, fun 2, fun 3 are all member functions of class abc. setdata and display are member functions of class def.
→      Consider the declaration within the class def friend class abc;
with this declaration class def declares that class abc its friend. It means that all the member fn of the class abc can access the private datameter data of class def.
→      a.fun 1(d1) ;
The member funtn fun 1 of class abc is called for object a1 of class abc. and object d1 of class df is passed as parameter the corresponding formal alias object will be a. The value of d.data i.e d1.data will be incremented by five. Similar explanation is applicable for calls of f2 and f3. The fun 1, fun 2, fun 3 are all member fn of class abc and they can still access private datamember data of the other class def. this is possible because that class def declares class abc as its friend.

Concept Of Data hiding & Encapsulation In C++

No comments on “Concept Of Data hiding & Encapsulation In C++”
  1.  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 the item data members is defined as private and member function will be defined as public. The public members of the class can be accessed from inside of the class as well as from the outside of the class. The private members of the class can be accessed from inside of the class but cannot be accessed from outside of the class. Thus private members remain hidden from outside of the class. Since  most of the time the data members are kept private it remains hidden from outside of the class and thus the data hiding is implemented. Since data members are private the class user cannot access them directly but ca access them through predefined functions. Thus the class user can access the data the way class developer likes it.

Program :-
The following program will act as an example for encapsulation as well as data hiding.
Develop a class called as circle with private data member radius. The class should have following member function.
  1. A function set radius that accepts value of the radius as parameter.
  2. A function get radius that will get the value of radius from user.
  3. A function to calculate and return area of the function.
  4. A function to calculate and return circumference of the circle.
  5. Write a suitable main function
# include
# define PI 3.14159
class circle
{
Private:
float radius;
Public:
void setradius (float r )
{
radius = r;
}
void get radius ( )
{
cin >>radius;
}
float area ( )
{
return PI * radius * radius;
}
float circum ( )
{
return 2 * PI *radius;
}
};
Void main ( )
{
circle c1, c2;
c1. Setradius (10.5);
cout << "Area=" << c1. Area ( ) << '\n';)
cout << "Circumference = " << c1 . circum ( ) << '\n';
cout << "Enter radius of the circle=";
c2 . get radius ( );
cout << "Area=" << C 2.area ( ) << '\n';
cout << "Circumference=" << c2.circum ( ) << '\n';
}

 

Explanation:-

  1. Encapsulation:

In the above program data member radius and four member function set radius, get radius, area and circum are defined together and thus the encapsulation is obtained

II.Data hiding:

 The data member radius is defined as private and hence it remains hidden from outside of the class. In other words we cannot access the data member radius from main function. Thus the data hiding is obtained.
The class circle provides member functions(facilities or methods) for calculating area and circumference but do not provide facility that member function to calculate diameter of the circle.
If class user wants to calculate diameter of the circle when the radius is known it will not be possible with the above mentioned class. This is because no member function is available to calculate diameter and moreover data member radius is private which cannot be accessed directly. Thus class user can access the data only in the manner the class developer wants it. Thus data hiding is implemented.

→ Private and Public access specifier:

 The private members of the class can be accessed from inside of the class can be accessed from inside of the class but cannot be accessed from outside of the class. In the previous example the private member radius is accessed within the class and it cannot be access from the main function.

→ Public members:

All the four member function of the class circle asre public and hence can be accessed from outside of the class.
Note:- The access specifier private is by default within the class.

Objects and allocated memory.

Prefer the class circle of the previous program.
Consider the statement circle c1, c2; written in the main fn using the above statement we are defining two objects of class circle.
Consider the following diagram.
As the above diagram indicates c1.radius 7 c2.radius will occupy separate memory allocation. This is because they have got different physical existence. The member function of the class circle. i.e set radius( ), get radius ( ), area ( ), circum ( ) are occupied only one in the memory.
The data members of the class will occupy separate memory for every object whereas member function will occupy the memory only once irrespective of no of objects. The member function of the class will be shared by all the objects.

Calling the member fn.

Consider the following statement
C1. Set radius (10.5);
Using the above statement we call the public member fn set radius for the object c1 and we are passing the parameter 10.5. This value 10.5 will be copied into formal parameter. The value of r i.e 10.5 will be copied into radius i.e c1.radius. This is because the member fn c1 11 called for object c1.

Program :-
Declaring the member fn within the class and defining them outside of the class.
Consider the following program:
# define PI 3.14159
# include
class circle;
{
float radius;
public:
void setradius (float);
void getradius ( );
float area ( );
float circum ( );
};
void circle :: setradius (float r)
{
radius = r;
}
void circle :: getradius ( )
{
cin >> radius;
}
float circle :: area ( )
{
return PI * radius * radius;
}
float circle :: circum ( )
{
return 2 * PI * radius;
}
void main ( )
 
{≡
}
Explanation:
 
In the above program all the four member fn are declared within the class and are defined outside of the class.
When the member fn are defined outside the class. There are general syntax is given as follows.
Returntype classname ::memberfnnamE(optional list of parameters)
{≡
}
Consider the following function header
void circle : : setradius (float r)
The above fn header indicates that set radius is member fn that belongs to class circle. It accepts one floating point parameter and returns nothing. We use scope resolution operator ( :: ) to indicate that member fn belongs to the class circle.
In the above program all the member fn are physically return outside of the class but their scope belongs to the class only. Hence private member radius can be still accessed within all the member fn.

STRUCTURES IN C++

No comments on “STRUCTURES IN C++”

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 of same type as well as of different types.

 

Defining a structure data type :-

The general syntax of declaring structure data type is a follows.

struct datatype

{

datatype member 1 ;

datatype member 2 ;

……………………

……………………

……………………

datatype member n ;

} ;

As the general syntax indicates, the structure datatype is made up[ of members. The member can be of different data types.

Example :-

struct student

{

int roll-no ;

float percent ;

char name [ 40 ] ;

}

In the above example, the student is defined as structure datatype with members, roll-no of type integer, percent of type float and name which is array of 40 characters.

The structure data type is also called as structure tag.

Declaring variables of structure data type –

 The general syntax of declaring a structure variable is as follows.

Structure datatype variable name.

example

struct student s1 ;

Due to the above example, the variable S1 of type struct student is declared. The compiler will allocate a space of 46 bytes to store the information of S1.

Method 1 :                               Method 2 :

struct student                          struct student

{                                              {

int roll_no;                              int roll_no ;

float percent;                           float percent ;

char name [ 40 ] ;                    char name [ 40 ] ;

} S1;                                        }

struct student S1;

The net effect of both the above method is same.

Accessing individual Members of the structures

1)      When we define a structure data type and its variable, then it becomes necessary to deal with every individual member of the structure.

2)      The general syntax of accessing the structure members is as follows.

Structure variable name, member name.

Example :-

struct  student

{

int roll_no ;

float percent ;

char name [ 40 ] ;

 }

struct student S1 ;

…………………

…………………

S1. roll_ no = 12 ;

S1. percent = 86.33 ;

S1. name = “xyz” ;

………………..

………………..

As the example indicates, using three assignment statements, we have assigned information to every individual member of a structure.

Assignment of complete structure variable :-

Consider the following example

Example –

struct  student

{

int roll-no ;

float percent ;

char name [ 40 ] ;

}

struct student S1, S2 ;

……………………..

……………………...

S1. roll_no = 2 ;

S1. percent = 87.67 ;

S1. name = “abc” ;

S2 = S1 ;

…………………….

…………………….

Due to the statement S2 = S1 ; the values of all the members of Slar copied into corresponding members of S2.

 The effect of,

S2 = S1;

Can be shown as follows

The statement S2 = S1 ; carry out he job of three assignment statement as shown below.

S2. roll_no = S1. roll_no ;

S2. percent = S1. percent ;

S2. name = S1. name ;

Nested Structures / Embedded Structures / Structure within Structure / Structure as a members of structure:-

It is possible to define a structure as a member of the other structure resulting into nested structure. Consider the following example.

struct data

{

int dd,mm,yy ;

} ;

struct student

{

int roll_no ;

float percent ;

char name [ 40 ] ;

struct date birth date ;

} ;

struct student S1 ;

In this example we have defined structure data type date with three members dd, mm and yy. The student is also defined as structure data type with the following member.

roll_no of type int

percent of type float

name as array of 40 characters

birth date of type date.

It means that, member birthdate of structure –e student itself is another structure.

ARRAY OF STRUCTURES :-

1) We have defined a structure data type called as student. When we want to deal with information of number of students, then we can define array of struct student.

2)  Consider the following example

struct student

{

int roll_no ;

char name [ 40 ] ;

float percent ;

} ;

struct student S [ 60 ] ;

In the above example, ‘S’ is defined as array of 60 elements and every element is of type struct student. In other word ‘S’ is an array of 60 students.

The member of the ith student can be accessed as follows.

S [i]. roll_no ;

S [i]. name

S [i]. percent

 

1) WAP that reads one date and prints the day number of the year.

→      # include

# include

struct date

{

int  dd, mm, yy :

} ;

void main (  )

{

int year [ 13 ] = { 0, 31, 28, 31, 30, 31, 31, 30, 31, 30, 31}

struct date d1;

int i, sum = 0 ;

clrscr (  ) ;

cout << “Enter a date in dd mm yy format =” ;

cin >> dl.dd >> dl.mm>> dl.yy ;

for ( i – 1 ; i < d1.mm ; i + + )

sum = sum + year [i] ;

sum = sum + dl.dd ;

if (dl.mm >2)

if ( dl.yy % 400 = = 0 || dl.yy % 4 = = 0 & &. dl.yy % 100 ! = 0)

sum + + ;

cout << “It is day number” << sum “of the year” ;

getch (  ) ;

}

2) WAP that reads one date and prints ‘Happy New Year’ if it is first day of the year, otherwise it should print ‘Have a Nice Day’.

→      # include

# include

struct date

{

int dd. mm. yy ;

};

void main (  )

{

struct date dl ;

clrscr ( ) ;

cout << “Enter a date in dd. mm. yy format =” ;

cin >> dl. dd >> dl. mm >> dl. yy ;

if ( dl. dd = = 1 & & dl. mm = = 1 )

cout << “Happy New Year \n” ;

else

cout << “Have a Nice Day \n” ;

 getch ( );

}

 

3) WAP that reads one today’s date and any other date. The pgm should print whether the other date has been already passed or yet to come or whether it is today’s date only.

→      # include

# include

struct date

{

int dd,mm. yy ;

} ;

void main (  )

{

struct td, ad ;

clrscr (  ) ;

cout << “Enter today’s date =” ;

cin >> td. dd >> td. mm >> td. yy ;

cout << “Enter other date =”;

cin >> ad. dd >> ad. mm >> ad. yy ;

if ( ad. yy > td. yy )

cout << “other date is yet to come \n” ;

else

if ( ad. yy < td. yy )

cout << “Other date has been passed \n” ;

else

if ( ad. mm > td. mm )

cout << “other date is yet to come \n” ;

else

if ( ad. dd > td. dd )

cout << “ It is today’s date only \n” ;

getch (  ) ;

}

 

4) WAP that reads roll_no and marks of PCM of not more than 60 students.  Your  pgm  should  calculate  average of  PCM  of  all

students and it should print roll_no and average of all students.

→      # include

# include

# include

struct student

{

int roll_no ;

int p, c, m,

float avg ;

} ;

void main (  )

{

struct student s[ 60 ] ;

int i , n ;

clrscr (  ) ;

cout << “How many students =” ;

cin >> n ;

cout << “Enter into all students \n” ;

for ( i = 0 ; i < n ; i + + )

{

cout << “Roll_no ;

cout << “marks of p , c, & m = ” ;

cin >> s[ i ] – p >> s[ i ] – c >> s[ i ] . m ;

s[ i ] . avg = ( s[ i ] p + s[ i ] c + s[ i ] . m

}

cout << “Roll_no \t  average \n”;

for ( i = 0 , i < n ; i + + )

{

cout << setw ( 7 ) << s[ i ] . roll_no << ‘\t’ ;

cout << setw ( 7 ) << setprecision [ 2 ] << s[ i ]. avg << ‘\n’ ;

}

getch (  ) ;

}

1)  WAP that reads information of not more than 100 employees. It consists of :

a)Employees_id

b)Employees_name

c)Designation

d) Salary

Your pgm should calculate allowances and taxes based on salary and should print the net amount payable to every employee. The details are as follows :

If salary > = 1000 then                          DA = 110% of salary

HRA = 15% of salary

TAX = 10% of salary

If salary > = 5000 and salary < then      DA = 110% of salary

HRA = 20% of salary

TAX = 8% of salary

Otherwise                                              DA = 100% of salary

HRA = 25% of salary

TAX = 2% of salary

→      # include

# include

# include

struct employees

{

int id ;

char name [ 40 ] ;

char designation [ 20 ] ;

float salary , da, hra, tax, net ;

} ;

void main (  )

{

struct employee e[ 100 ] ;

int i , n ;

clrscr (  ) ;

cout << “Enter info all employees =” ;

cin >> n ;

cout << “Enter info of all employees \n” ;

for ( i = 0 ; i < n ; i + + )

{

cout << “ id = ” ;

cin >> e[ i ] .id ;

cout << “ name  = ” ;

gets ( e[i].name ) ;

cout << “ Designation = ” ;

gets ( e[i] .designation ) ;

cout << “ salary  = ” ;

cin >> e[i].salary ;

for ( i = 0 , i < n ; i + + )

{

if ( e[i].salary > = 10000 )

{

e [ i ] . da = 1.1 * e [ i ] . salary ;

e [ i ] . hra = 0.15 * e [ i ] . salary ;

e [ i ] . tax = 0.1 * e [ i ] . salary ;

}

else

if ( e[ i ] . salary > = 5000 )

{

e [ i ] . da = 1.1 * e [ i ] . salary ;

e [ i ] . hra = 0.2 * e [ i ] . salary ;

e [ i ] . tax = 0.08 * e [ i ] . salary ;

}

else

{

e [ i ] . da = 1.1 * e [ i ] . salary ;

e [ i ] . hra = 0.25 * e [ i ] . salary ;

e [ i ] . tax = 0.02 * e [ i ] . salary ;

}

e [ i ] . net = e [ i ] . salary + e [ i ] . da + e [ i ] . hra – e [ i ].tax;

}

for ( i = 0 ; i < n ; i + + )

{

cout << “Id =” << e [ i ] . id << ‘\t’ << “Name =” << e [ i ] . name << ‘\n’ ;

cout << “Designation =” << e [ i ] . designation << ‘\n’ ;

cout << “Salary =” << e [ i ] . salary << ‘\n’ ;

cout << “DA =” << e [ i ] . da << ‘\t’ HRA =” << e [ i ] . hra << ‘\n’ ;

cout << “Tax =” << e [ i ] . tax << ‘\n’ ;

cout << “Net =” << e [ i ] . net << ‘\n’ ;

}

getch (  ) ;

}

Structure and pointer :

Using the pointer the structure variable can be accessed indirectly. Consider following example :

Structure student

{

int roll_no ;

Float percent ;

char name [ 40 ] ;

} ;

Struct student S1 ;

Struct student * P ;

- - - - - - - - - - -

- - - - - - - - - - -

p = & S1 ;

- - - - - - - - - - -

- - - - - - - - - - -

 

In the above example . . have define S1 as variable type struct student and p is defined type pointer to struct student.

  • Consider the following statement :

P = & S1

Due to this statement, the p stores address of S1. In other word P will act as the pointer to S1.

  • If we want to assign a value 10 to the roll_no of S1 then it can be done with three different methods

a)  S1roll_no = 10 ;

b)  (*p) . roll_no = 10 ;

c)  P → roll_no = 10 ;

  • The first method is without using pointer. Where as next two methods we use the pointers.
  • the meaning of the second and third method is nothing but roll _no of that structure variable, which is being pointer by P. Since P point to S1, effectively second and third method result into S1 roll_no.

Program :

Write a function that accepts pointer to struct student and calculate the PCM for that student. write suitable main (  ) to read roll_no and marks of PCM for more than 60 students program should calculate the average of PCM fro every student using a function and should print roll_no. average of the PCM and class for every student.

Program :

→      # include

# include

struct students

{

int roll_no ;

int p, c, m ;

float avg ;

}

 void main (  ){

struct student s[ 60 ] ;

int i , n ;

void cal_avg ( struct student * ) ;

clrscr (  ) ;

cout << “How many student ( n.m + 60 ) =” ;

cin >> n ;

cout << “Enter the information of all the students \n” ;

for ( i = 0 ; i < n ; i + + )

{

cout << “roll_no =” ;

cin >> s[i].roll_no ;

cout << “Marks of P, C & M =” ;

cin >> s[i]. p >> s[i] .m>>s[i].c  ;

}

for ( i = 0 ; i > n ; i + + )

{

cout << “Roll_no =” << s [ i ] . roll_no << \t ;

cout << “Average =” << s [ i ] . avg << \t ;

if ( s [ i ] . avg > = 70 ) cout << “Distinction \n” ;

else if ( s [ i ] avg > 0 60 )

cout << “first class \n” ;

else

if ( s[i].avg >=50 )

cout <<” second class” \n ;

else

if ( s[ i ].avg > = 40)

cout << “Pass \n” ;

else

cout << “fail \n” ;

}

getch (  ) ;

}

void cal_avg ( struct student * q )

{

q → avg = q → p + q → + q → m ) /3.0 ;

}

void cal_avg ( struct student * q )

{

( * q ) . avg = ( c * q ) . P + ( * q ) . c + ( * q )  m \3.0 ;

}

Function with default parameters (arguments)

No comments on “Function with default parameters (arguments)”

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 (8,30);

disptime (8);

disptime ( );

}

Void disptime (inthr, intmn, intsec )

{

cout << hr <<' : ' << sec << '\n';

}

O/P:-           8:29:39:                8:29:39

8:30:0                            8:30:0

8:0:0                     8:0:0

8:0:0                     8:0:0

→      The prototype of function disptime indicates that it accepts three integers with default values 8, 0 and 0

→      In the first call of disptime we are passing all the three arguments. This will be copied into hr, min and sec and no default value will be utilized hence the o/p is 8:29:39

→      In the 2nd call only two actual parameters are passed. This parameters will be copied into hr and min. sec will get the default value i.e 0. Hence the o/p is 8:30:0

→      In the 3rd call only once actual parameters are passed. This parameters will be copied into hr. and sec will get the default value i.e and hence o/p is 8:0:0

→      In the 4th call no actual parameters are passéd. Hence hr, min and sec will take the default initial value i.e 8, 0 and 0 respectively hence o/p is 8:0:0

 

Program :-

# include

void main ( )

{

void dispdate ( int = 1, int = 1, int = 2006);

dispdate ( );

dispdate (26);

dispdate (15,8 );

dispdate ( 31,10, 2005 );

}

Void dispdate  ( int d, int m, int y )

{

cout << d << '/' << m << '/' << y << '\n';

}

O/P:-

1/1/2006

26/1/2006

15/8/2006

31/12/2005

Objects and Classes in C++

No comments on “Objects and Classes in C++”

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 allow us to define functions as members of the structures.

To  implement object oriented programming  ,it is necessary to declare data members and associated functions together.

Therefore c do not support object oriented programming.

In c++ it is possible to define data as well as functions as members of the structure or members of the class.

Therefore c++ supports oject oriented programming.

Class:- is nothing but a datatype that defines set of objects having identical characteristics.

The class definition is often made up of data  members and members functions.

Object:- The object is nothing but the physical existence of the class.

The object is also called as instance.

Consider the following eg:-

Class music-system

{

float length, breadth, depth;

float cost;

char color;

int no_of_speakers;

Public:

Void playcas ( );

void played cd ( );

void forward ( );

void rewind ( );

void record ( );

};

 

Music_system m1, m2;

→      In the above eg we have defined a class called music system which has got data members length, breadth, cost, color, depth, no of speakers.

→      The class have got following member function playcas, played, forward, rewind, record.

→      The m1 and m2 are defined as objects o6 class music system.

→      The members of the class will be accessed for the object as follows object name, member name.

More Articles …

  1. POINTERS in C++
  2. Arrays in C++
  3. Functions in C++
  4. STORAGE CLASSES IN C++
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Page 2 of 21

  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions