#include<iostream>
#ifndef TVFM_H_
#define TVFM_H_
using std::cout;
using std::endl;
class Remote;
class Tv
{
public:
friend class Remote;
enum state {OFF,ON};
enum {MiniVal,MaxVal=20};
enum {Antenna,Cable};
enum {TV,DVD};
Tv(int a = OFF, int nc = 100) :state(a), maxchannel(nc), volume(5), channel(2), mode(Cable), input(TV) {};
void onoff();
bool ison();
bool volup();
bool voldown();
void chanup();
void chandown();
void set_mode();
void set_input();
void setting();
void set_Remote(Remote& r);
private:
int state;
int volume;
int maxchannel;
int channel;
int mode;
int input;
};
class Remote
{
public:
friend class TV;
enum state { OFF, ON };
enum { MiniVal, Maxval = 20 };
enum { Antenna, cable };
enum { TV, DVD };
enum { normal, interact };
private:
int mode;
int Remote_mode;
public:
Remote(int n = TV) :mode(n), Remote_mode(normal) {};
bool volup(Tv& t)
{
return t.volup();
}
bool voldown(Tv& t)
{
return t.voldown();
}
void onoff(Tv& t)
{
t.onoff();
}
void chanup(Tv& t)
{
t.chanup();
}
void chandown(Tv& t)
{
t.chandown();
}
void set_mode(Tv& t)
{
t.set_mode();
}
void set_input(Tv& t)
{
t.set_input();
}
void set_chan(Tv& t, int n)
{
t.channel = n;
}
void show_Remote_mode()
{
cout << "Remote mode:" << Remote_mode << endl;
}
};
void Tv::set_Remote(Remote &r)
{
r.Remote_mode = (r.Remote_mode==Remote::normal?Remote::interact:Remote::normal);
}
#endif
以上是代碼,在VS2019提示Remote::Remote_mode不可訪問。
求大神們解答。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/270037.html
標籤:C++ 語言
上一篇:關于字符指標陣列的賦值,求助!
