barbaros a écrit :
On Apr 23, 10:48 am, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
My question is: can it be done using inheritance ?
Technically, yes:
class OrientedBody(Body):
def __init__(self, orient=1):
Body.__init__(self)
self.orient = 1
Now if it's the right
Thanks to Paul McGuire and Bruno Desthuilliers for their comprehensive
answers. This is exactly what I was looking for, except I did not know
the correct name (composition/delegation). Now all I have to do is to
study the supplied code, understand it and adapt it to my problem.
Thank you very
Hello everybody,
I am building a code for surface meshes (triangulations for instance).
I need to implement Body objects (bodies can be points, segments,
triangles and so on), then a Mesh will be a collection of bodies,
together with their neighbourhood relations.
I also need OrientedBody
barbaros a écrit :
Hello everybody,
I am building a code for surface meshes (triangulations for instance).
I need to implement Body objects (bodies can be points, segments,
triangles and so on), then a Mesh will be a collection of bodies,
together with their neighbourhood relations.
I also need
barbaros wrote:
Hello everybody,
I am building a code for surface meshes (triangulations for instance).
I need to implement Body objects (bodies can be points, segments,
triangles and so on), then a Mesh will be a collection of bodies,
together with their neighbourhood relations.
I also need
Andrew Lee a écrit :
(snip)
as a rule of thumb .. if you are using isinstance in a class to
determine what class a parameter is ... you have broken the OO contract.
Nope.
Remember, every class ought to have a well defined internal state and a
well defined interface to its state.
I don't
On Apr 23, 10:48 am, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
My question is: can it be done using inheritance ?
Technically, yes:
class OrientedBody(Body):
def __init__(self, orient=1):
Body.__init__(self)
self.orient = 1
Now if it's the right thing to do is
On Apr 23, 10:44 am, barbaros [EMAIL PROTECTED] wrote:
If I understand correctly, in the above implementation I cannot
define firstly a (non-oriented) body, and then build, on top of it,
two bodies with opposite orientations. The point is, I want
both oriented bodies to share the same base