Create a class TV having the following attributes and functions.(C++)
1. Volume (int)
2. currentChannel (int)
Create another class called Remote Control having the following functions
1. volumeUp()
2. volumeDown()
3. ChannelUp()
4. ChannelDown()
Make the remote class friend of TV class.
class TV {
int Volume;
int currentChannel;
TV(int Volume, int currentChannel) {
this->Volume = Volume;
this->currentChannel = currentChannel;
}
friend class RemoteControl;
};
class RemoteControl {
void volumeUp();
void volumeDown();
void ChannelUp();
void ChannelDown();
}
Comments
Leave a comment