I have posted earlier today more about my project! I have now sorted out the compile errors with the include files! I worked out that unlike Java or C, for a whole C++ project you only need to write #include "file.cpp" in any one of the files, if you do mulitple include statements for a file (not a library function) it see's it as a redeclaration for some uknown reason!!!

Anywayz; I have now come up to another problem!!! Basically, here is my design;

AndGate
OrGate
NotGate
XorGate
are all classes that inherit common functions from the class LogicGate. My idea was that i could then create a vector to store logic gates of different types in the same place, and therefore have easy tracking of the circuits components! However, When I do this, you can insert instances of the inheritted classes into the vector, but you can't access the added functionality of them!!!

Does anyone know if this is possible???

LogicGate:
int input1
int input2
int output
int id
int parentID1
int parentID2

then functions for gettting and setting pid's, id, inputs, etc. are standard for all logic gates

AndGate, XorGate, OrGate & NotGate all overide the LogicGate function;
getOutput - calculates the output depending on the input values supplied to the object.

So basically, I do the following;
Code:
// Create some objects of different gates for testing!
AndGate myAndGate;
OrGate myOrGate;
XorGate myXorGate;
NotGate myNotGate;

vector <LogicGate> myCircuit(0); // start off circuit empty

// add the objects to the vector
myCircuit.push_back(myAndGate);
myCircuit.push_back(myOrGate);
myCircuit.push_back(myNotGate);
myCircuit.push_back(myXorGate);

// Set the input values for the gates:
myCircuit.at(0).setInputs(1,1);
myCircuit.at(1).setInputs(1,1);
myCircuit.at(2).setInputs(1,1);
myCircuit.at(3).setInputs(1); // NOT GATE - Only one input!!! - function over-riding in use.

// Now get the outputs for the gates:
int a = myCircuit.at(0).getOutput();
int b = myCircuit.at(0).getOutput();
int c = myCircuit.at(0).getOutput();
int d = myCircuit.at(0).getOutput();

// write outputs...
cout<<"and: "<<a<<endl<<"or: "<<b<<endl<<"xor: "<<c<<endl<<"not: "<<d<<endl;
This doesn't seem to be working, but I can assure you that the logic gate classes are all working because i have spent all day checking this to get it perfect!!! ...My only problem is finding a way to store the different gates!

I thought that by doing it this way, it would work because the getOutput function in class LogicGate is over-ridden by the AndGate, OrGate, NotGate and XorGate classes so in effect all objects within the vector would be the same!!! Obviously i am wrong!!! any guidance, much appriciated!!! Thanks!!! Matt