algorithmic modeling for Rhino
Tags:
Hi Andrea
you cannot derive from a struct in C# and Vb.Net, not you can do so in Python.
In .Net, you can only derive from non-sealed classes and implement (derive) interfaces.
In Python, if you try deriving from Point3d, you will receive this message:
"Cannot derive from Rhino.Geometry.Point3d because it is a value type".
http://msdn.microsoft.com/en-us/library/ms173149.aspx
What are you trying to do?
- Giulio
______________
giulio@mcneel.com
Hi,Giulio
I just want to create a class mypoint3d which inherit the properties(such as x,y,z position) from the Point3d.....can u tell me how to scri
Gracias!
Hi Andrea
Point3d represents a value: therefore inheritance cannot be achieved. That's just it.
What you can do, though, is store a Point3d inside your class and the use its properties and methods from within it. *
For example, if you are making a simplified model of the Solar System, you might create a Planet class, with Position, Radius and Color properties. Then Earth and Mars are two instances of the Planet class, each with a different Position and Radius. Also, Earth will be assigned color blue, Mars color red.
Please have a look at any Python, Vb.Net or C# references, especially books, about how and why things are specified this way. A full explanation here would be very very long!
I am copying some links from here:
Do you need any other book link or general pointer?
Cheers,
- Giulio
______________
giulio@mcneel.com
* other two alternatives could be: create your own MyPoint3d class/struct that does not have things in common with Point3d and either store a single Point3d field within it, or re-implement the properties. But why?
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by