Framework design, initialization and framework usage

Robert M. Münch robert.muench at saphirion.com
Mon May 6 16:50:14 UTC 2019


I want to build a framework which gives some structure to the app using 
it. To create this structure I would like to use interfaces. The 
application then uses these interfaces and implements the required 
functions. I want to provide a clear initialization sequence for the 
app through the framework. Which means, specific functions are called 
at specific points in the framework startup code. The framework should 
be the main frame for the application.

struct myFramework {
	myFrameworkApp myFWApp;
}

interface myFrameworkApp {
	void init();
}

main(){
	myFramework mf = new myFramework;

	mf.myFWApp.init(); // this bombs because myFWApp is NULL
}

class myAppCode : myFrameworkApp {
	void init() {...}
}


How can I create an instance of myAppCode from within the framework 
code an have it call the init function? Or do I have to create a 
myAppCode global with a predefined name and use this symbol within the 
framework code?

I'm a bit lost, now to get things started from the framework and 
plug-in user specific application code.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list