Operator new[]

I don't clearly understand the difference between the simple instance of an object as:
 
  LogicGate new_logicgate;


and instance through new[] operator as:
 
  LogicGate * p1 = new LogicGate;


In which case I have to use them? And what about the deletion in these different case?

Which technique would be convenient if I have to do 1) , 2) and 3):

1)instatiate a number N of object LogicGate (that has a vector<LogicGate*> as member, which has the function of connecting the i-th object of LogicGate to another instatieted object of " LogicGate next_gate" according to some conditions, as it was a wire of a circuit connecting two logic gates), with N depending on a condition?

2) collect these object in some
 
vector<LogicGate> AND 
or another vector<LogicGate> OR , depending on gate's type?

3) repeatedly fill and void vector<bool> input and vector<bool> output in order to test the circuit?

Thank you
Last edited on
closed account (48T7M4Gy)
http://stackoverflow.com/questions/6337294/creating-an-object-with-or-without-new
Topic archived. No new replies allowed.