Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2010 How to access class properties through an interface?

$
0
0
Hi!

I have two classes A and B. B inherits from A.

A has a protected property P that is of type IMyInterface. At runtime it is set to an object of type C that also implements the interface.

Now from B I need to alter P. I have acccess to it since it is declared as protected. But the problem is that when I try to change the property P it is not available, since all I see in B is the interface iMyInterface. I don't see the public variables that C contains.

Is there a way to make an on the fly cast of P to type C so I can access property P and make the change?

kind regards
Henrik

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>