

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Two lab tasks related to Object Oriented Programming. The first task requires the creation of a class Distance and a friend function to convert kilometers into meters. The second task requires the creation of two classes Distance1 and Distance2, a friend function to add their kilometers, and a function to convert kilometers into meters. code examples and a main function to test the classes. The document can be useful for students studying Object Oriented Programming and C++ programming language.
Typology: Lab Reports
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Lab Task 9.1 Create a class Distance which has a data member kilometers initialized by constructor. Define a friend function of this class that will convert kilometers into meters. Write main function to test this class. #include
Lab Task 9.2 Create two classes Distance1 and Distance2 that have data member kilometers initialized by their constructors. Define a friend function of both these classes that will add both these kilometers. Convert kilometers into meters and display the result. Write main function to test this class. #include