Warning: include_once(../../../headder.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 16

Warning: include_once(): Failed opening '../../../headder.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 16

CBSE Computer Science - Revision Tour(Solved)

CBSE Guess > eBooks > Class XII > CBSE Computer Science Class And Object Solved Revision Tour By Mr. Ravi Kiran

COMPUTER SCIENCE CLASS AND OBJECTS


Warning: include(../../../ads_330x250_middle.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 23

Warning: include(): Failed opening '../../../ads_330x250_middle.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 23

Previous Index Next

2004:

2.b) Declare a class myfolder with the following specifications:

Private members of the class:
Filenames    an array of strig of size[10][25] .(to represent all the names of files inside myfolder)
Availspace    long. (to represent total number of bytes available in myfolder)
Usedspace  long. (to represent total number of bytes used in myfolder)

Public members of the class:
Newfileentry() : A function to accept values of Filenames, Availspace and Usedspace from user.
Retavailspace(): A function that returns the value of total kilobytes available(1 kilobyte=1024 bytes)
Showfiles(): A function that displays the names of all the files in myfolder

Ans:

class myfolder
{ char Filenames[10][25];
long Availspace;
long Usedspace;
public:
void Newfileentry( )
{ cout<<"\nEnter any 10 file names: ";
for(int i=0;i<=9;i++)
{cout<<"\nEnter the "<<i+1<<" file name: ";
gets(Filenames[i]);
}
cout<<"\nEnter the Available Space (In Kilobytes): ";
cin>>Availspace;
cout<<"\nEnter the Used Space (In Kilobytes): ";
cin>>Usedspace;
}
long RetavailSpace( )
{ ret Availspace;
}
void Showfiles( )
{ cout<<"\nThe names of the files inmyfolder object....";
for(i=0;i<=9;i++)
{ puts(Filenames[i]);
cout<<endl;
}
}

2002:

2.a) What do you understand about a member function? How does a member function differ from an ordinary function?

Ans: A member function is a function declared within a class. It is said to be defined in two ways. Ie Outside the class and inside the class. When a member function is defined outside the class, the name of the function must be the full name including the class name as well. When a member function is defined inside the class, the name of the function is similar to an ordinary function but
it will become an inline function.

 

Previous Index Next

CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] )



Warning: include(../../../120_60_others.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 82

Warning: include(): Failed opening '../../../120_60_others.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/computer_science1/calss_object4.php on line 82