![](/img/trans.png)
[英]Flutter Class inherence
我在使用超級類和子類構造函數時遇到問題。 我在 super class 中聲明了一組變量,我在我的子類上調用了 super,但是我無法通過子類訪問超類變量。 如下所示,在我的 fromJson 方法中,我無法訪問 TennisAttributes 中的 userRating 字段。 ...
[英]Flutter Class inherence
我在使用超級類和子類構造函數時遇到問題。 我在 super class 中聲明了一組變量,我在我的子類上調用了 super,但是我無法通過子類訪問超類變量。 如下所示,在我的 fromJson 方法中,我無法訪問 TennisAttributes 中的 userRating 字段。 ...
[英]The Hit Object Within the BlockLogic Superclass is Not Being Called
當我按下小寫的 L 鍵時,我想要調用 hit object,每次將方塊的長度和寬度減少 5。 似乎 BlockNorm 中的代碼沒有正確引用 BlockLogic 中的命中 object。 按下 l 時沒有效果,但也沒有錯誤。 我嘗試放置 print('test'),但沒有打印任何內容。 如果我將 ...
[英]Why in Ruby Object's singleton_class isn't Class?
我有點疑惑,為什么singleton class的超級class用的是is_a? 方法但返回假? 我 我認為它會返回 true。 請有經驗的高手幫幫我 ...
[英]Use cases of a default sub class constructor that doesn't add any functionality?
我有一本摘要書 class: 還有一個子 class: 在我的書 class 中添加以下default constructor是否有任何優勢: ...
[英]How to define a superclass constraint for free monoids?
考慮以下類型 class 的免費幺半群。class FreeMonoid f where inj :: a -> f a univ :: Monoid m => (a -> m) -> f a -> m inj向自由幺半群注入一個值,而univ是自 ...
[英]Does super() run in compiletime and this() run in runtime? and why?
在此程序中,它將打印“Student 1 Person 1 Undergrad 2” 這意味着 super.method1() > super() of student this.method2() this of Undergrad() super() 是否在編譯時運行而 this() ...
[英]problem initializing django serializer with extra vars to be used in choice field
我有一個這樣的 django 序列化器 這是我的問題的簡化版本。 我正在嘗試動態初始化一個具有選擇字段name的序列化程序,它的選擇來自初始化后傳遞給序列化程序的 kwargs。 如果我在這個 class 上調用OPTIONS方法,它會返回 如果我發出POST請求並傳遞有效載荷 它正確返回 但是如果 ...
[英]User input shape size, then calculate using class in python
嗨,我是初學者,這是編碼的詳細信息。 創建一個名為 shape 的父對象 class。 這應該有以下方法 inputSides() – 要求用戶輸入形狀的邊。 現在為圓形、矩形和三角形創建子類。 這些應該包括一個適當的 area() 方法,該方法將使用形狀 class 的邊值。 這是我想到的,但仍在 ...
[英]It keeps me looping even though I don't have any loops
我不知道出了什么問題,但它讓我一直循環,即使我按下或輸入 1,我希望它調用子類代理,但當我按下 2 時,它調用子類,這里出了什么問題我一直在我想在里面呆了 5-7 個小時,我的眼睛都瞪圓了 這里的代碼塊假設調用這個 class 這是主要方法 ...
[英]Can behavior of subclasses vary according to traditional modeling?
我開發了一個 class 圖,我不確定我是否理解超類的作用。 在我的圖中,用戶是一個超類,但我仍然擁有具有不同行為的用戶的不同角色。 是否允許覆蓋子類的行為,或者這從根本上是錯誤的? 這種情況有更好的設計嗎? ...
[英]JavaScript: How to call STATIC method on superclass but the method isnot defined on the derivated class?
我有這些課程: class Control { static Code = 3; static GetCodeChain() { var result = []; result.push(this.Code); if (super.GetCodeChain) { result = result. ...
[英]What components of the superclass do the subclasses inherit?
超類的所有子類都繼承了超類的實例變量、構造函數、修改器和訪問器嗎? 假設超類的所有成員都是公開的。 ...
[英]What is super() when subclassing a list? How do I access the underlying list directly?
我最近有一個用例,我需要子類list並需要從子類( Foo )中訪問底層列表。 我認為super()會提供底層列表,但它沒有。 相反,我不得不做super().__getitem__(slice(None)) ,它提供了底層列表的副本。 如何直接訪問基礎列表? 我對super()的理解缺少什么? ...
[英]Updating Old wxPython App: Invalid Window Calling Super/Parent Method
我正在嘗試使用 wxWidgets/wxPython 2.8 更新為 Python 2.7 編寫的舊應用程序。 我正在嘗試使其與我當前系統的 Python (3.10) 和 wxPython (4.0) 版本兼容。 我在嘗試調用超級/父方法時遇到錯誤。 class 派生自wx.ScrolledWi ...
[英]Java Superclass Methods: keyword "this" vs "super"
說我有: 我創造 通過 super.print() 和 this.print() 訪問 A 中的 print() function 有什么區別? 兩者似乎都可以訪問該方法。 ...
[英]Can I call a subclass' private method from its parent class?
在閱讀了 Ruby 的訪問控制之后,我了解到私有方法只能在類內和該類的子類內被隱式調用。 不過,我有一個示例,其中一個類似乎在其子類上調用私有方法default_chain ,它仍然有效: 這是怎么回事? ...
[英]self.__class__ in parent class' method is missing arguments
我正在使用的包包含類 A。我希望我的新類 B 繼承自該類。 最小的例子: 在孩子身上調用父母的方法會拋出: 如何在不更改 A 類中的任何內容的情況下解決此問題? 非常感謝您的幫助! ...
[英]How can I make my subclasses more efficient?
我正在創建一個游戲,對於單位/角色,我有一個名為 Unit 的基類,看起來像這樣。 self._stat 應該代表沒有 buffs 或 debuffs 的基本 stat,默認值,self.stat 是在整個游戲中使用和更改的那個。 然后我有使用 Unit 作為基類的子類,就像這樣。 但是 ...
[英]what could be triggering this error in my code "Expected type 'str', got 'tuple[int, int]' instead
我一直在尋找可能是什么原因,但無濟於事。 這是我下面的 main.py 代碼 和對應的類 我什至檢查了這里是否解決了類似的問題,但看不到。 ...
[英]getSuperClass() throws Exception but getSuperclassName() returns the name of the super class
第一行輸出類名:RestController 第二行拋出異常: ...