A class design issue
I have defined a tree of database classes, extended from the root class R.
Now I want to define a caching database class A, so that for any two subclasses, B and C, of R,
I can use 'a = new A(new B(), new C())' to create a database instance that works like B and all changes to B are backed up in C.
I want 'a' to work anywhere B is accepted. Any way I do that?
Alternatively, I can put the caching functionality into R, so I can do 'a = new B(new C())'. But it seems to me an overkill. Unless the first option doesn't work.
Thanks!

