October 30th, 2010, 02:51 PM
This solution works but it is ludicrously complicated.
There is one base class and one derived class. The base class has all the default behaviour and the derived class has all the specialised...
October 30th, 2010, 09:13 AM
Yeah I was worried about that (hence the comment in my 1st post) kind of stuff, for example what happens with the 'this' pointer if Derived uses multiple inheritance.
I thought it must be safe...
October 30th, 2010, 08:18 AM
Have a look at this, it uses only one derived class. You change the behaviour of funcA, funcB, funcC at run time.
#include <iostream>
class Base
{
public:
October 29th, 2010, 04:34 PM
Not entirely sure how safe this is ...
class Base
{
public:
Base(int i, int j)
{
October 29th, 2010, 03:08 PM
see above :)
I can tidy it up tomorrow if you can wait but its getting late here.
October 29th, 2010, 02:51 PM
Have you considered using pointers to memberfunctions instead of virtual functions?
My syntax here is all wrong but I hope you get the idea
class Base
{
public:
Base(int i, int j)
{