Код: Выделить всё
Node.hКод: Выделить всё
class Node{
private:
vector inputs;
vector outputs;
int state;
public:
void addOutput(Wire *a);
void addInput(Wire *a);
Node* getInput(unsigned int i);
Node* getOutput(unsigned int i);
void setState(int st);
int getState(void);
};
< /code>
[b]main()Код: Выделить всё
int main(int argc, char *argv[])
{
Node* b=new Node(INPUT, "B");
Node* a=new Node(INPUT, "A");
Node* Cin=new Node(INPUT, "Cin");
Node* d=new Node(XOR, "D");
Wire* w=new Wire(a,d);
d->addInput(w);
a->addOutput(w);
vector inputs;
vector outputs;
for(int i=0;i
[b]node.cppvoid Node::addInput(Wire *a)
{
inputs.push_back(a);
}
void Node::addOutput(Wire *a)
{
outputs.push_back(a);
}
string Node::getName()
{
return name;
}
void Node::setState(int st)
{
state = st;
cout
Подробнее здесь: https://stackoverflow.com/questions/232 ... same-class
Мобильная версия