.net - Set a variable to a module -


in project, have several modules, same set of subs. each module use different brand of rfid card reader, access methods , reader output different, exact same steps followed. in application want make generic calls these steps, have application setting determines module call from, prevent having change of calls project project. want like:

public card_reader_module modmti   'which doesn't work 

then

card_reader_module.connect() ... etc 

or there better way this?

for design have described should use interface describe methods want use , implement interface in new class each type of device.

so example interface looks this:

public interface idevice     sub connect() end interface 

then create class each device has specific implementation each device in here:

public class devicetype1     implements idevice      public sub connect() implements idevice.connect         'connect type of device here     end sub end class 

the beauty of design can define variable of type 'idevice' , instantiate particular type:

dim dev idevice dev = new devicetype1 dev.connect() 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -