As the title said, I have two different objects from two classes that share the same inheritance.
When I modify an inherited variable in obj1, it also modifies the variable in obj2.
Can someone please help me and tell how do I change the value only on obj1?
For further understanding of the issue, imagine that I have the following class:
When I modify an inherited variable in obj1, it also modifies the variable in obj2.
Can someone please help me and tell how do I change the value only on obj1?
For further understanding of the issue, imagine that I have the following class:
class fish:
position = [0,0,0];
def setPosition(self,pos):
self.position = pos;
class tuna(fish):
#extra variables here!
class salmon(fish):
#extra variables here!
obj1 = salmon();
obj2 = tuna();
obj1.setPosition([1,1,1]);When I check obj2.position, it is the same as obj1.
