cost 230 ms
將 setStragy 添加到 VectorSource

[英]Add setStragy to VectorSource

我使用 openlayers js 庫版本 6.15.1 我有一個繼承 VectorSource 的類。 我不知道在我的構造函數中做什么因為我想要我自己的策略。 我不能調用 super({ strategy: this._myStrategy, ... }) 那么該怎么做呢? 我可以在 Vecto ...

將只讀變量傳遞給父構造函數 | 打字稿

[英]Passing a readonly variable to parent constructor | Typescript

我是 TypeScript 的新手,我正在嘗試將readonly變量傳遞給父類的構造函數: ChildClass 將被更多的類擴展,因此是抽象的。 有什么辦法可以在super構造函數中傳遞只讀變量嗎? ...

使用 ursina 和制作 texturebox() 時的屬性錯誤

[英]Attribute error when using ursina and making texturebox()

當我運行代碼時,它說: 這是我使用的程序。 我嘗試使用快速修復,但一段時間后它不適用於問題。 也不管修正標記變綠多少次,我點擊運行它仍然說屬性錯誤,我不確定我做錯了什么。 ...

Python:迭代更改超類方法

[英]Python: Iteratively change superclass methods

我想創建一個與list相同的 class Packet ,除了它可以與int對象進行比較。 與int進行比較應返回與與僅包含該int的Packet進行比較相同的結果。 下面的定義做我想要的。class Packet(list): def __init__(self, iterable=()) ...

我可以使用 Java 中子 class 的 super 關鍵字為父 class 屬性賦值嗎?

[英]Can I assign a value to a parent class attribute using super keyword from the child class in Java?

這里的新手試圖在 setter 方法中使用“super”關鍵字來為父 class 屬性“price”賦值。 父 class 屬性在我調用 setter 的 class 之外沒有得到更新,盡管它似乎在 class 和“繼承?”中得到更新。 即使我沒有使用“this”關鍵字,價格版本也會更新。 我錯過 ...

2022-12-08 16:39:16   1   27    java / super  
在一個無類的、純粹基於函數的擴展類型系統中,如何模擬超級方法的調用(而不是 super() 調用本身)?

[英]Within a class-free, purely function-based, extending type system how does one emulate the invocation of a super method (not the super() call itself)?

我希望調用父 function(沒有超級)而不是繼承的子 function。如果不使用 ES 類,我有哪些選擇? ...

為什么第 4 行只打印出“B move”?

[英]Why does line 4 only print out "B move"?

我試圖理解這段代碼的輸出。 我了解除第 4 行以外的其他輸出。 代碼: output:A move B move A keep B move A keep C keep 我期待第 4 行打印出“B move.C move”,但它只是在“B move”處結束。 我認為它與第 5 行具有相 ...

運行超級 class 方法后如何返回子 class 實例?

[英]How do I return a child class instance after running a super class method?

我有 2 個 python 類,一個是另一個的子類 對於我經常使用的一些方法,上面的方法效果很好。 問題是 class A 有很多方法,有些我正在使用,有些我正在修改,等等。還有一些我不關心。 A 中的大多數方法返回 A 的另一個實例(例如選擇、添加、重新排序數據)但是我想確保無論我調用哪個A. ...

完全覆蓋繼承的 __init__ Class Python 3

[英]Totally override __init__ in inherited Class Python 3

我有 class Game和 class RecentGame繼承自 class Game 。 我不需要 class RecentGame中的__init__與 class Game的__init__有任何共同之處,所以我沒有使用super() function。但我確實需要這個 inherita ...

Typescript:super.super 調用受保護的方法

[英]Typescript: super.super call on a protected method

我正在嘗試擴展/覆蓋 class 中的受保護方法,我們將ChildClass稱為 class 庫的受保護覆蓋方法tapNode在ParentClass中,其方法調用super到GrandParentClass tapNode 我想覆蓋行為,以便ChildClass可以在從ParentClass擴展時 ...

Python 的 Super() 如何在多個 inheritance 中為超類工作?

[英]How Python's Super() works in multiple inheritance for superclasses?

我試圖了解 super 如何在 python 的多個 inheritance 中為超類工作,例如在下面的代碼中: 如果我刪除super().__init__(**kwargs)執行結束 '第三' object 沒有屬性 'parm2' 僅打印parm1和parm3 ,即使我在Class Third ...

python3 super() Pycharm 中的新樣式自動完成

[英]python3 super() new style autocompletion in Pycharm

使用 python3 我們不再需要在調用super時顯式設置父 class :def __init__(self): super().__init__() 但似乎 PyCharm 不知道它,因為當我嘗試為某種方法自動完成super時,它使用舊樣式,我收到這個:def setUp(self) ...

子類化列表時的 super() 是什么? 如何直接訪問基礎列表?

[英]What is super() when subclassing a list? How do I access the underlying list directly?

我最近有一個用例,我需要子類list並需要從子類( Foo )中訪問底層列表。 我認為super()會提供底層列表,但它沒有。 相反,我不得不做super().__getitem__(slice(None)) ,它提供了底層列表的副本。 如何直接訪問基礎列表? 我對super()的理解缺少什么? ...

python 3 中的臨時 object 是什么?

[英]What is a temporary object in python 3?

我正在了解super()方法的作用,並且遇到了術語temporary object 。 我不明白這是什么意思。 我聽說它是一個 object,你打算稍后扔掉,但我不知道這也意味着什么。 那么,什么是temporary object ? ...

為什么對父 class 構造函數的調用不調用在子 class 中覆蓋的父方法?

[英]Why does the call to a parent class constructor not call the parent's methods that are overriden in the child class?

如下代碼所示,給定超類Parent的方法calculate()在Parent的構造函數中調用,但也在 class Child中被覆蓋,為什么在Child的構造函數中對Parent的構造函數的隱式調用不調用Parent的calculate()而不是Child的calculate() ? Outpu ...

Ubuntu - 如何僅從超級鍵替換語言快捷方式

[英]Ubuntu - How to replace language shortcut from only Super key

在安裝 Ubuntu 20(從 18 升級)時,向導讓我選擇用於更改輸入語言的組合鍵。 我在 Ubuntu 18 中的組合鍵是 Super+space,但我沒有在那里找到它並選擇了“Super”(單獨)。 我不知道如何更改它 - 在“設置”中它說當前組合是“超級+空格”(這不是唯一的組合)。 現在我 ...

將參數傳遞給凍結的超級數據類

[英]Passing parameters to frozen super dataclass

我有一個簡單的(凍結的)數據類 inheritance 如下: 根據文檔,它看起來很有希望: attrs_pre_init會在 attrs 開始初始化之前自動檢測並運行。 如果您需要注入對 super() 的調用,這很有用。 初始化() 但是當我檢查mypy時,我得到: 請注意,這不是this的副 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM