C
colin
Hi,
Im trying to implement a generic list class for a number of 3d object types,
that form a 3d solid model, take the easiest one Point for example,
it contains a Vector3 and a list of other 3d object types
such as surfaces and wires wich also reference this point.
I need to be able to search the list for an exisitng Point
but just using the Vector3, then if its not in the list
to insert a new Point with the given coordinates.
Is there a good/easy way of doing this with a template class
with only specifying the one type ie Point in the template ?
I had problems in that you cant use parameters in a new statement,
nor have static functions in the interface.
I dont realy want to resort to using object as a parameter.
nor do I want to use a list such as <key,value> pair
as the key is in the value. although I dont need it to be fast.
Im stil relativly new to c# and I tried it a few ways using class template
with 2 types but
it was awkward, even trying to use an interface template as the base for the
3d objects.
I keep trying to do the things I know I can do in C++ wich probably isnt so
good.
In the end I found it easier to do a seperate list class for each type,
as trying to use templates I seemed to end up with more helper classes,
and the information was buried under more layers when viewed in the
debugger.
thanks
Colin =^.^=
Im trying to implement a generic list class for a number of 3d object types,
that form a 3d solid model, take the easiest one Point for example,
it contains a Vector3 and a list of other 3d object types
such as surfaces and wires wich also reference this point.
I need to be able to search the list for an exisitng Point
but just using the Vector3, then if its not in the list
to insert a new Point with the given coordinates.
Is there a good/easy way of doing this with a template class
with only specifying the one type ie Point in the template ?
I had problems in that you cant use parameters in a new statement,
nor have static functions in the interface.
I dont realy want to resort to using object as a parameter.
nor do I want to use a list such as <key,value> pair
as the key is in the value. although I dont need it to be fast.
Im stil relativly new to c# and I tried it a few ways using class template
with 2 types but
it was awkward, even trying to use an interface template as the base for the
3d objects.
I keep trying to do the things I know I can do in C++ wich probably isnt so
good.
In the end I found it easier to do a seperate list class for each type,
as trying to use templates I seemed to end up with more helper classes,
and the information was buried under more layers when viewed in the
debugger.
thanks
Colin =^.^=