Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pin
- {
- bool wartosc;
- public:
- void ustaw (bool test);
- bool zwroc () { return wartosc; }
- Pin () { wartosc = 0; }
- Pin (bool w) : wartosc(w) {}
- friend class Sygnal;
- friend class AND;
- //friend class OR;
- //friend class XOR;
- //friend class NOT;
- //friend class NOR;
- //friend class NAND;
- };
- void Pin::ustaw (bool test)
- {
- wartosc = test;
- }
- class Bramka : public Abstrakcyjna
- {
- static unsigned int LiczbaWszystkichBramek;
- string bramka; bool w1, w2, wyjscie;
- public:
- static string sukces () {string ob= "Stworzono obiekt o nazwie: "; return ob; }
- void reset () { w1=0, w2=0; }
- friend class AND;
- //friend class OR;
- //friend class XOR;
- //friend class NOT;
- //friend class NOR;
- //friend class NAND;
- };
- class AND : public Bramka
- {
- static unsigned int id;
- //string bramka; <-------- Zdeklarowane w klasie bramka
- public:
- static unsigned int _id() ;
- string opis_bramki ();
- AND () {}
- AND (Pin _var1, Pin _var2); // <-------- Zdeklarowane w klasie Pin
- string _nazwa ();
- bool wyjscie () { return w1 && w2; } // <-------- Zdeklarowane w klasie bramka
- };
- unsigned int AND::id=0;
- unsigned int AND::_id () {id++; return id;}
- string AND::_nazwa()
- {
- bramka=sukces()+bramka; // <-------- Zdeklarowane w klasie bramka
- return bramka;
- }
- string AND::opis_bramki()
- {
- ostringstream ss;
- ss << id;
- string str = ss.str();
- string a="AND "; string b=str;
- string w=a+b;
- return w;
- }
- AND::AND (Pin _var1, Pin _var2)
- {
- w1=_var1.wartosc;
- w2=_var2.wartosc;
- id=_id ();
- bramka=opis_bramki (); // <-------- Zdeklarowane w klasie bramka
- sukces();
- }
Add Comment
Please, Sign In to add comment