Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Device{
- protected:
- bool PoweredOn;
- int DeviceID;
- string Manufacturer;
- public:
- Device(bool p, int i, string c):PoweredOn(p), DeviceID(i), Manufacturer(c)
- {cout << "Konstruktor Device" << endl;}
- virtual ~Device(){cout << "Destruktor Device" << endl;}
- void Turn(){
- if(PoweredOn==0){
- PoweredOn = 1;
- }
- else{
- PoweredOn = 0;
- }
- }
- void virtual ConnectDisconnect()=0;
- };
- class USBDevice: public virtual Device{
- protected:
- float USBStandard;
- bool Connected1;
- public:
- USBDevice(float a=0, bool b = 0, bool p = 0, int i = 0, string c = "Kingston" ):USBStandard(a), Connected1(b), Device(p,i,c){
- cout << "Konstruktor USBDevice" << endl;}
- virtual ~USBDevice(){cout << "Destruktor USBDevice" << endl;}
- virtual void ConnectDisconnect(){
- if(Connected1==0){
- cout << "USB uredjaj nije spojen." << endl;}
- else{
- cout << "USB uredjaj je spojen." << endl;}}
- };
- class NetworkDevice: public virtual Device{
- protected:
- float NetworkStandard;
- bool Connected2;
- public:
- NetworkDevice(float e=0, bool d=0, bool p=0, int i=0, string c="Linksys"):NetworkStandard(e), Connected2(d), Device(p,i,c){
- cout << "Konstruktor NetworkDevice" << endl;}
- virtual ~NetworkDevice(){cout << "Destruktor NetworkDevice" << endl;}
- virtual void ConnectDisconnect(){
- if(Connected2==0){
- cout << "Network uredjaj nije spojen." << endl;}
- else{
- cout << "Network uredjaj je spojen." << endl;}}
- };
- class WirelessAdapter: public NetworkDevice, public USBDevice{
- protected:
- int NumberOfAntennas;
- int gain;
- public:
- WirelessAdapter(int z, int y, float a=0, bool b=0, float e=0, bool d=0, bool p=0, int i=0, string c="Adata"):NumberOfAntennas(z), gain(y), USBDevice(a,b), NetworkDevice(e,d), Device(p,i,c)
- {cout << "Konstruktor WirelessAdapter" << endl;}
- virtual ~WirelessAdapter(){cout << "Destruktor WirelessAdapter" << endl;}
- virtual void ConnectDisconnect(){
- if(Connected1==0){
- USBDevice::ConnectDisconnect();}
- if(Connected2==0){
- NetworkDevice::ConnectDisconnect();}}
- void status(){
- cout << "Broj USB uredjaja:" << Connected1 << endl;
- cout << "Broj Network uredjaja:" << Connected2 << endl;}
- };
- int main(){
- WirelessAdapter Zenga(2, 1, 2.0, true, 802.11, true, false, 505, "Toshiba");
- Zenga.status();
- Zenga.ConnectDisconnect();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement