Professional Documents
Culture Documents
10M
c) pointer to objects
2. What is friend function and explain why it is needed with an example program. 10M
3. Demonstrate with a program how to pass an object as argument and How are dynamic
objects created with an example 10M
4. What is operator overloading? How is operator overloading achieved? Show with an
example by overloading + + 10M
5. Explain the syntax for overloading operators using.
i) Member function
ii) Friend function
10M
6. Design, develop, and execute a program in C++ to create a class called STRING and
implement the following operations. Display the results after every operation by
overloading the operator <<
.i. STRING s1 = VTU
ii. STRING s2 = BELGAUM
iii. STIRNG s3 = s1 + s2; (Use copy constructor)
10M
7. Design, develop, and execute a program in C++ to create a class called STACK using an
array of integers and to implement the following operations by overloading the operators +
and - :
i. s1=s1 + element; where s1 is an object of the class STACK and element is an integer to
be pushed on to top of the stack.
ii. s1=s1- ; where s1 is an object of the class STACK and operator pops off the top
element.Handle the STACK Empty and STACK Full conditions. Also display the contents
of the stack after each operation, by overloading the operator <<.
10M
8. Design, develop, and execute a program in C++ to create a class called OCTAL, which
has the characteristics of an octal number Implement the following operations by writing an
appropriate constructor and an overloaded operator +.
10M
UNIT - 4
1. Demonstrate how a member function declared in base class be redefined in derived class.
Write a C++ program to create a base class Shape. Use this class to store two double type
values that could be used to compute the area of figures. Derive two specific classes called
Triangle & Rectangle from the base Shape. Add to the base class, member function
get_data( ) to initialize base class data members and another member function display_area( )
to compute & display the area of figures
10M
2. What is Inheritance. Explain the types of inheritance with an example 10M
3. Differentiate between private members and protected members. Write a C++ program to illustrate
protected members in the base class & explain when we use protected visibility specifier to a class.
10M
4. . Explain the visibility of the base class members for the access specifiers: private, protected and
5. An electricity board charges the following rates to domestic users to discourage large consumption of energy
: For the first 100 units 50 P per unit, Beyond 300 units 60 P per unit, If the total cost is more than
Rs.250.00 then an additional surcharge of 15% is added on the difference. Define a class Electricity in which
the function Bill computes the cost. Define a derived class More_Electricity and override Bill to add the
surcharge.
10M
-10MEMPLOYEE
char emp_no
char emp_name
char
emp_designation
char emp_type
read_empdetails( )
SALARY : EMPLOYEE
basic_pay
allowance: 120% of basic_pay
IT: 30%
Netsal
DISPLAY: SALARY
display_Empdetails( )
get_saldetails( )
calculate_netsal( )
05M