I have an abstract class NetworkTest and some derived classes PingTest, SMTPTest, and POP3Test. Each Test class overrides a Run() function and has it's own private member variables.

I have a txt file for each type of test - ping.txt, pop3.txt, smtp.txt that defines the tests that should be run, in the format

ping.txt

IP
IP
...

smtp.txt

server:port:usr:pw:email_address
server:port:usr:pw:email_address
...

pop3.txt

server:port
server:port
...

I have a ReadTestsFromFile() for each type of test. However, since these return a List(of TypeOfTest), they cannot be member functions of the derived classes. So the question is, where do I put ReadPingTestsFromFile(), ReadPop3TestsFromFile() and ReadSMTPTestsFromFile() ? I currently just have them in a module, but that seems a little less "principled" than the nice OOP structure I've been trying to follow with the rest of this program.

Can anyone comment on how you would do this?

Thanks!

Dave

Recommended Answers

All 2 Replies

Use delegate.

I've been reading about delegates and don't see how this answers my question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.