Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems with super()
#3
(Apr-10-2024, 08:39 AM)Gribouillis Wrote: I think multiple inheritance should be used warily and possibly not at all, an exception being the case of mixin classes.

In your code, the intention behind the classes is not obvious, so it is difficult to give a clear advice. However, remember that inheritance means the ISA relationship, but in your case, I'd tend to believe that the StaticObject is a CollisionObject having a certain shape. Its relation to shape is more HAS-A shape than IS-A shape. If this is true, you could replace inheritance with composition, which is usually considered a better design...

Thank you for your reply. I originally structured my code with IS-A relations, but in the example code my professor gave me there were a lot of HAS-A relations, hence why I changed it. I think I will revert my code back to the IS-A relations I used to have.

Thank you for your help!
Reply


Messages In This Thread
Problems with super() - by Hoespilaar - Apr-10-2024, 07:54 AM
RE: Problems with super() - by Gribouillis - Apr-10-2024, 08:39 AM
RE: Problems with super() - by Hoespilaar - Apr-10-2024, 10:10 AM
RE: Problems with super() - by kanetracy - Jun-11-2024, 02:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  super() in class akbarza 1 615 Dec-19-2023, 12:55 PM
Last Post: menator01
  superclass and super() grkiran2011 1 1,817 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  MRO About super() catlessness 1 2,138 Jan-12-2020, 07:54 AM
Last Post: Gribouillis
  Super with Sublime Text - TypeError: super() takes at least 1 argument (0 given) Shafla 6 7,669 May-04-2019, 08:30 PM
Last Post: Shafla
  Is any super keyword like java rajeev1729 2 3,422 Sep-14-2017, 07:47 PM
Last Post: snippsat
  Multiple Inheritance using super() Sagar 2 7,402 Sep-08-2017, 08:58 AM
Last Post: Sagar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020