Object-Oriented Programming LAB # 5
Object-Oriented Programming LAB # 5
AIR UNIVERSITY
Student Name:
Objectives:
This lab is made to develop student understanding related to C++ friend function & friend classes.
LAB ASSESSMENT:
Data presentation
Experimental results
Conclusion
Date: Signature:
Page | 1
BCE-2A OOP LAB
LABORATORY
EXPERIMENT NO.5
The input selection chooses between TV, which could be either cable or broadcast TV, and a
VCR. Some sets may offer more choices, such as multiple VCR/DVD inputs, but this list is
enough for the purposes of this example. Also, a television has some parameters that aren’t state
variables. For example, televisions vary in the number of channels they can receive, and you can
include a member to track that value. i.e. Max Channels and Max volume. Viewer can also be
able to see the following settings if TV is on:
“Volume setting = “
“Channel setting = “
“Mode = “
“Input = “
Next, you must provide the class with methods for altering the settings. Many televisions these
days hide their controls behind panels, but it’s still possible with most televisions to change
channels, and so on, without a remote control. However, often you can go up or down one
channel at a time but can’t select a channel at random. Similarly, there’s usually a button for
increasing the volume and one for decreasing the volume. A remote control should duplicate the
controls built in to the television. A single remote of a company control can control several
televisions of the same company. Many of its methods can be implemented by using TV methods.
In addition, a remote control typically provides random access channel selection. That is, you can
go directly from channel 2 to channel 20 without going through all the intervening channels. Also,
many remotes can work in two modes—as a television controller and as a VCR controller.
TEST PLAN
Page | 2
BCE-2A OOP LAB
Page | 3
BCE-2A OOP LAB
Page | 4
BCE-2A OOP LAB
Page | 5
BCE-2A OOP LAB
Page | 6
BCE-2A OOP LAB
Page | 7
BCE-2A OOP LAB
CONCLUSION
• Friend functions allow controlled access to private data while maintaining encapsulation.
• They enable efficient data sharing between independent classes.
• They provide flexibility by allowing non-member functions to operate on private members.
• They help in implementing operations like swapping values between different classes.
Page | 8