A problem with classes - derived type

Paulo da Silva p_s_d_a_s_i_l_v_a_ns at netcabo.pt
Mon May 9 00:20:50 EDT 2016


Hi!

Suppose I have a class A whose implementation I don't know about.
That class A has a method f that returns a A object.

class A:
	...
	def f(self, <...>):
		...

Now I want to write B derived from A with method f1. I want f1 to return
a B object:

class B(A):
	...
	def f1(self, <...>):
		...
		res=f(<...>)

How do I return res as a B object?

Thanks.



More information about the Python-list mailing list