超类继承自一个子类。 Coursera。他们疯了吗? [英] Superclass inherits from a subclass. Coursera. Are they crazy?

查看:228
本文介绍了超类继承自一个子类。 Coursera。他们疯了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给我绝对正确的确认我是对的。



真相在哪里?

解决方案

测验必须有错误,在问题是声明 MyInt int 子类(或等价: int MyInt 超类,没有其他方法。 >

Learn to Program: Crafting Quality Code

Screenshot

This is a video lecture from Coursera Learn to Program Crafting Quality Code Course. So there is a quiz during the video.

class MyInt(int):
    # some code there

They gave 4 answers where I need to choose a right one. I've choose my answers one by one but finally they say that right is absolutely wrong answer.

int is a subclass of MyInt

This question Python: How do I make a subclass from a superclass? gives me absolutely right confirmation that I'am right.

Where is the truth?

解决方案

There must be something wrong with the quiz, the code as written in the question is declaring that MyInt is a subclass of int (or equivalently: that int is the superclass of MyInt), no the other way around.

这篇关于超类继承自一个子类。 Coursera。他们疯了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆