Create a non-virtual function Initialise()
in the base class that calls Init
eg:
abstract class DxShape
{
protected void Initialise()
{
Init();
}
protected abstract void Init();
//...
}
As pointed out in the comments below, Initialise
must be made either public or static (only in C#), it may remain protected in C++.
In C++ you could then make Init private and only access it via calls to Initialise
. See non-virtual interface http://en.wikipedia.org/wiki/Non-virtual_interface_pattern