Python Forum
Python inner classes inheritance from parent class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python inner classes inheritance from parent class
#2
Why 2 classes?

class Numbers:
    def __init__(self,a,b):
        self.sum = a + b
        self.prod = a * b
 
twoNumbers = Numbers(5,4)
 
print(twoNumbers.sum, twoNumbers.prod)
Reply


Messages In This Thread
RE: Python inner classes inheritance from parent class - by Axel_Erfurt - Apr-21-2025, 07:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Classes rob101 4 1,692 Feb-05-2024, 06:51 PM
Last Post: rob101
  super() and order of running method in class inheritance akbarza 7 2,652 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
Question [solved] Classes, assign an attributes to a class not to instances.. SpongeB0B 4 2,129 May-20-2023, 04:08 PM
Last Post: SpongeB0B
  Understanding Python classes PythonNewbee 3 2,295 Nov-10-2022, 11:07 PM
Last Post: deanhystad
Sad Python classes PythonNewbee 4 2,254 Nov-09-2022, 01:19 PM
Last Post: deanhystad
  Child class inheritance issue eakanathan 3 2,320 Apr-21-2022, 12:03 PM
Last Post: deanhystad
  dict class override: how access parent values? Andrey 1 2,670 Mar-06-2022, 10:49 PM
Last Post: deanhystad
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 4,061 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  Inheritance vs Instantiation for Python classes mr_byte31 7 5,764 Oct-14-2021, 12:58 PM
Last Post: mr_byte31
  Understanding Python super() for classes OmegaRed94 1 2,529 Jun-09-2021, 09:02 AM
Last Post: buran

Forum Jump:

User Panel Messages

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