Possible Duplicate:
Private/protected inheritance
What is the cost of inheritance?
I am sorry if this question is a duplicate. I have a C++ class say A, which has some methods , out of which I am interested only in one method. I need to implement a new class B , which has got same data members as that of A. I don't want everything of A in B but that one method ( or may be a couple ) . B should strictly implement a new operation X , but should not expose anything what A has been doing.
So does it make sense to inherit B from A? How expensive is this in terms of memory footprint , performance ? Will it be sensible if I duplicate that one method from A to B , without inheriting B from A? What other alternatives do I have?