0% found this document useful (0 votes)
18 views

Oops Part B (II)

The document discusses various object-oriented programming concepts in C++ including operator overloading, friend functions, type conversion, templates, inheritance, virtual functions, and runtime polymorphism. It provides examples of overloading operators like + and << to perform operations on user-defined types like matrices and complex numbers. It also discusses friend functions and how they can be used to overload operators. Other concepts covered include basic to class and class to basic type conversions, function and class templates, different forms of inheritance in C++, visibility of base class members, abstract classes, and polymorphism through virtual functions.

Uploaded by

anurajah23
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Oops Part B (II)

The document discusses various object-oriented programming concepts in C++ including operator overloading, friend functions, type conversion, templates, inheritance, virtual functions, and runtime polymorphism. It provides examples of overloading operators like + and << to perform operations on user-defined types like matrices and complex numbers. It also discusses friend functions and how they can be used to overload operators. Other concepts covered include basic to class and class to basic type conversions, function and class templates, different forms of inheritance in C++, visibility of base class members, abstract classes, and polymorphism through virtual functions.

Uploaded by

anurajah23
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SCAD ENGINEERING COLLEGE DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Sub. Code / Sub. Name Academic Year Batch : CS59 /Object Oriented Programming : 2011 -2012(Odd Semester) : 2009-2013

Course Teacher : Mrs.C.Anuradha

Unit II Part B

Operator overloading and Friend Functions


List out the rules for overloading operators with example. Explain about Unary Operator and Binary Operator overloading with program. Write a C++ program to implement complex number addition, subtraction and multiplication using binary operator overloading. Write a C++ program to overload + operator to add two matrices. Define friend class and friend function. Explain each with example. What do you mean by function overloading? Discuss when we use this concept. Write a program for overloading the assignment operators How to achieve operator overloading through friend function? Write a program using friends function for overloading << and >> operators. Perform the following operation using operator overloading Voltage 1 = Voltage 2 + Voltage 3

Type conversion
Define basic to class type conversion with an example. Define class to basic type conversion with an example. Define one class to another class conversion with an example.

Templates
Explain the Function template Explain the Class template

Inheritance
What are the different forms of inheritance supported in C++? Discuss on the visibility of base class members in privately and publicly inherited classes.

Virtual Functions & Runtime Polymorphism


Define the polymorphism. Explain the different types of polymorphism.

What are the virtual functions? Explain their needs using a suitable example. What are the rules associated with virtual functions? Explain virtual functions with an example. What are abstract classes? Give an example (with the program) to illustrate the use of abstract classes. Describe virtual class and virtual functions.

You might also like