How to remove a Property/Function/Sub

  • Thread starter Thread starter Captain Chaos
  • Start date Start date
C

Captain Chaos

Hello

I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?

Thanx for suggestions :-)
 
You can make the functions private. Thus, B will not be able to use them.

However, if you have other classes inheriting from A, and some of them do
need these items, then you may want to rethink your hierarchy.
 
* "Captain Chaos said:
I have a class B that has inherited a class A.

In Class A there is a Property/Function/Sub/Event implemented
that i do not want to see if using Class B.

Is it possible to remove some Properties/Function/etc
without having access to Class A ?

That's breaking the inheritance hierarchy and it's not possible.
Something which is inherited, will be available in all subclasses. You
will have to rethink the design of your class hierarchy.
 
Thanx, I think you are right and I would give the same answer to myself :-)

But I can not rethink of the other design........

I have no access to the Code of Class A !

That's the Problem.........

Well, and now ?

I thought about hiding Property/Function/Sub/Event via Attributes.

The Problem is that I can only hide the the ones of Class B
and even if i shadowing the Properties of A in B they are not hidden.

I have tried these Attributes:
<ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never),
ComponentModel.Browsable(False),
ComponentModel.DesignerSerializationVisibility(ComponentModel.DesignerSerial
izationVisibility.Hidden)> _

Seams the only solution is to shadow it and set it obsolete

and fire an error if somebody using it.


But that's not very nice......


My UserControl for example has no Click Event...........
But the Windows.Forms.UserControl has it.........
Any many other useless Properties that nobody neads and confusing my
Customers using my Control.......

Should I rebuild the Class "Windows.Forms.UserControl" myself ?
Is this possible ? And How ?

Thanx anyway :-)
 
I tried to make it Privatein Class B:

Private Shadows Property AcceptButton() As Windows.Forms.IButtonControl


But I see the Property anyway if i use Class B:

I think then it takes the Property of Class A......
 
Back
Top