Frank,
As I stated:Wanting to remove P1 from X is stating A *IS NOT A* X.
Which is it, is A an X or Not?
As I stated you cannot remove a member from a class, if you "removed" P1
from A, what do you expect the following code to do?
Dim anX As X
anX = New A
anX.P1
Remember that X has a P1, A inherits from X so you can assign an A object to
an X variable. Because you have an X variable you can call P1, however you
firmly insist that P1 does not exist on A. Yet the above code is calling P1
on A. What do you expect to happen? I am attempting to tell you what will
happen & why.
If the second base class causes polymorphism problems, I would consider
making P1 overridable, and override the method in A and simply throw a
NotSupportedException.
Something like:
Public Overridable Sub P1()
End Sub
Public Overrides Sub P1()
Throw New NotSupportedException()
End Sub
Then it's more efficient to
remove that one from A. Isn't it?
Introducing a second base class does not cause any "efficiency" problems.
I find it better to write "correct" programs then to worry about "what is
optimized". By "correct" I mean OO and use the correct tool for the correct
job (for example: when to add a second base class & when not to). Remember
that most programs follow the 80/20 rule (link below) that is 80% of the
execution time of your program is spent in 20% of your code. I will optimize
the 20% once that 20% has been identified & proven to be a performance
problem via profiling (see CLR Profiler in my other message).
For info on the 80/20 rule & optimizing only the 20% see Martin Fowler's
article "Yet Another Optimization Article" at
http://martinfowler.com/ieeeSoftware/yetOptimization.pdf
Hope this helps
Jay