Important Questions

CBSE Guess > Papers > Important Questions > Class XII > 2010 > Computer Science > Computer Science By Naveen Gupta

CBSE CLASS XII

g. Define a class named Publisher in C++ with the following descriptions :
Private members
Id long
title 40 char
author 40 char
price , stockqty double
stockvalue double
valcal() A function to find price*stockqty with double as return type Public members
a constructor function to initialize price , stockqty and stockvalue as 0 Enter() function to input the idnumber , title and author Takestock() function to increment stockqty by N(where N is passed as argument to this function) and call the function valcal() to update the stockvalue().
sale() function to decrease the stockqty by N (where N is sale quantity passed to this function as argument) and also call the function valcal() to update the stockvalue outdata() function to display all the data members on the screen.

Q. 3. a. Explain the different types of inheritance? With help of diagram.

b. Write the difference between public, protected and private?

c. class RED
{
char n [ 20 ];
void input ( );
protected:
int x , y ;
void read ( );
public :
RED ( );
RED ( int a );
void get_red ( );
void put_red ( );
};
class WHITE : protected RED
{
void a , b ;
protected :
int c , d ;
void get_white( );
public:
WHITE ( );
void put_white ( );
};
class BLACK : private WHITE
{
void * p ;
char st[20];
protected :
int q;
void get_black( );
public:
BLACK ( );
void put_black ( );
}ob;

  1. Name the data members and functions which are accessible by the objects of class BLACK.
  2. Give the size of object ob
  3. Name the OOPS concept implemented above and its type.
  4. Name the members accessible by function get_black( );

Paper By Mr. Naveen Gupta
Email Id : [email protected]