Quote:Original post by bpoint
Is there something I'm missing that will allow me to transparently access the members of class A from class B?
There is nothing you can do. The static type of your variable
b is
B*. Dereferencing a
B* does not yield a type with a function
func().
There's a special rule for operator->() in which it will continue to be applied to its own result until a raw pointer is reached (the standard words it a little differently, but that's the intent and the end result). Problem is, here, that
B* is already a raw pointer, so that rule doesn't apply.
As mentioned above, if you had a
B object the rule would apply and your object would work like a smart pointer. As you have it now, you've got a dumb pointer to a smart pointer. No matter how you dress it up, you're never going to make a dumb pointer act smart.
So, either provide some sort of explicit accessor function, provide forwarding functions, or use your smart pointer class in a more idiomatic manner.
--smw