Arne Saknussemm
6/16/2016 8:25:00 AM
On Sun, 12 Jun 2016 04:08:50 +0200
"Ulrich Korndoerfer" wrote in microsoft.public.vb.general.discussion
<ds3ui2F9rp9U1@mid.individual.net>:
> Use interfaces. Create an interface class cLogInterface for logging
> with a method InfoLog and then implement this interface in cLog and
> cLogFlash. Then at program start instantiate either a cLog or
> CLogFlash and save its pointer in a var of type cLogInterface. Then
> the switch can be omitted too.
Agreed 100%, I was about writing the same thing; this is a *perfect*
example of the use of such a VB OOP feature which is often forgotten
Another possible approach may be the following
Create a new "logger" project of type ActiveX DLL
Add to the main class module all the desired properties, methods and
events, include a property to allow setting the logging type
Add a couple private classes wrapping the two logging methods code,
those classes won't be exposed to the outside but only available inside
the "logger" object
Build the DLL
now, in the the main project set a reference to the "logger", instance
it, set the logging method and use it for whatever logging purpose,
this way you'll have a single object which will adapt itself to the
caller needs