osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

singleton ... again


Ethan Furman wrote:
> Say you have a class that represents serial ports or your computer.  You 
> should get the same object every time you ask for SerialPort(2).

No, you shouldn't ask for SerialPort(2) at all, you should
call get_serial_port(2). Then you won't be fooled into
thinking that you're creating an independent object each
time.

-- 
Greg