Python Forum
which design / pattern when building classes and subclasses
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
which design / pattern when building classes and subclasses
#3
(Nov-18-2022, 08:53 PM)Phaze90 Wrote: I need to build a mother-child-like class tree.

Dont know which is the best practice how to structure it.

I could define a top-level class A which has some own attributes and at least 1 sub class B.
The class B itself has again some own attributes and at least 1 sub class C, and so on...
It looks like you are confusing inheritance with composition, could you give a concrete example of your design?
ndc85430 likes this post
Reply


Messages In This Thread
RE: which design / pattern when building classes and subclasses - by Gribouillis - Nov-19-2022, 08:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "unexpected keyword arg" when initializing my subclasses Phaze90 3 3,294 Nov-25-2022, 07:39 PM
Last Post: Gribouillis
  Classes, OOP, building deck of 52 playing cards Drone4four 9 4,047 Jan-19-2022, 02:53 PM
Last Post: Drone4four
  User Subclasses holyghost 6 3,290 Mar-17-2021, 12:33 PM
Last Post: buran
  Design Pattern for accessing subclass attributes UGuntupalli 2 2,137 Jul-30-2019, 11:09 PM
Last Post: UGuntupalli
  Factory Design Pattern Prince 1 2,525 Apr-06-2018, 10:00 AM
Last Post: Larz60+
  Using classes? Can I just use classes to structure code? muteboy 5 5,158 Nov-01-2017, 04:20 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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