F
F
frontjss2020-04-06 05:02:48
Polymorphism
frontjss, 2020-04-06 05:02:48

Does my example have polymorphism?

class A():
  def __init__():
    pass

  def cprint():
    print("A")

class B():
  def __init__():
    pass

  def cprint():
    print("B")

class C():
  def __init__():
    pass

  def cprint():
    print("C")



obj_list = [A, B, C]


for obj in obj_list:
  obj.cprint()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-04-06
@Seasle

No. You just have three identical classes, also without inheritance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question