All,I've decided to post this question here as I think this is my best chance in getting an answer. I've got VB .net 2005. I'm familiar with creating a class with properties and methods and can even use interfaces. I understand overloading and simple examples of inheritance. I would like to replicate a behaviour of ArcObjects that I come to love and know, the QueryInterface. So first just look at the simple example below using ArcObjects.
' Retrieve a Polygon from a collection
Dim pPolygon as IPolygon
pPolygon = aCollection.Item(0)
Dim pArea as IArea
pArea = pPolygon 'QI
Msgbox pArea.Area
pArea could have been pointed to an Envelope or Ring not just a Polygon. I've been playing around with VB .Net trying to create classes that behave in the same way. I'm not talking about ArcObjects now just some class that I imagined up. How do you create a Class that you can point to another class. Take another example if you create a pointer of type IFeatureLayer and point it to a Layer you can access the search cursor but this not a method of ILayer.I was wondering if any of you hardcore coders had a trivial example of a VB .Net project that shows custom classes (nothing to do with ArcObjects) behaving this way? Does VB .Net even allow you to develop objects this way?Duncan