2
Answers

How can I enforce users' input object type?

minmin

minmin

16y
2.5k
1

Say I have a class and  it contructor is public Protocol(Object port) and I would only allow user to pass in the System.IO.Ports.SerialPort or System.Net.Sockets.TcpClient only, other object types will consider error. How can I achieve this enforcement?

Please help!

Answers (2)