Grasshopper

algorithmic modeling for Rhino

Hi all,

suppose we have an interface called "i" that implements igh_goo.
We have two abstract classes M0, M1 that implement i.
We have 5 classes (A, B, C, D, E) that inherit from M0 or M1.
And I want a parameter collect any of this 5 classes (A, B, C, D, E) in a list.


What would be the least worst option?

Create another abstract class that supports any of these 5 types? Create a generic class (for those 5 types)? Any other kind of wrap? Is there a better option?

Thanks in advance.

Views: 334

Replies to This Discussion

For now I'm betting on remove the igh_goo of the "i" interface, and put it in an envelope class.

Would there be a better choice?

Thanks for the reply Tom.

VB does not allow inherit more than one class. I want to consider the option that forces me to rebuild less code.

The question was not about polymorphism in itself but how to adapt it to a parameter of gh. Perhaps David has already created something for these cases.

Yes but that would force me to rewrite a lot because the two abstract classes share some of the same methods (names) with different procedures.
No matter, I made a class that implements igh_goo and is able to channel all types correctly. Furthermore thus avoid implement the interface igh_goo in each type.

Thanks anyway!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service