![](/img/trans.png)
[英]Why is my nested class not accessible? (Kotlin)
我試圖遵循嵌套類文檔中的示例: Kotlin 文檔 - 嵌套類和內部類所以我嘗試了:fun main(){ var tester = Test() println(tester.x) // 42 tester.Foo().bar() // compiler error - ...
[英]Why is my nested class not accessible? (Kotlin)
我試圖遵循嵌套類文檔中的示例: Kotlin 文檔 - 嵌套類和內部類所以我嘗試了:fun main(){ var tester = Test() println(tester.x) // 42 tester.Foo().bar() // compiler error - ...
[英]Is it possible to have static constexpr fields in a private inner class?
我有一個 C++14 項目,不能使用 C++17 內聯變量。 是否有可能讓它在 C++14 中工作,或者這只能在 C++17 中工作? ...
[英]Initializing a new nested class from outer class function
我目前正在構建項目時學習 C++ 中的嵌套類,我目前在setupBLE()中我需要傳遞一個嵌套類但是要init新的 class 我需要將外部 class 傳遞給它的構造函數以便它可以訪問它變量和函數,但我不確定如何將試圖創建它的 class 的指針傳遞給構造函數。 這有點令人困惑,所以我希望代碼對 ...
[英]Looping a text file creating a nested hash from data and updating the hash
我正在嘗試處理以文本文件形式提供的一系列運動結果。 每行包含主隊名稱、客隊名稱和結果。 然后我需要更新聯賽表以顯示每支球隊的一些統計數據。 我最初將它作為 class 來嘗試,但認為它作為嵌套的 hash 可能更簡單,因為我認為我無法在不知道團隊名稱的情況下設置新對象,並且這可能會在以后更改,例如 ...
[英]Create a type hint that uses an inner class to be provided by derived classes
我正在構建一個處理序列化數據的 API,並且我更願意添加對盡可能多的靜態分析的支持。 我受到 Django 的Meta模式的啟發,用於在類上聲明元數據,並使用類似於pydantic的內部庫來檢查類型注釋以進行序列化。 我希望 API 可以像這樣工作:class Base: Data: typ ...
[英]Problem with writing UnitTests when multiple classes are in same file
我嘗試解決一些編碼挑戰並遇到問題,我將挑戰和測試復制到我的電腦並嘗試解決它們,但這次我無法讓測試正常工作,我認為問題在於基本上一個文件中有兩個頂級類,但其中只有一個是公共的(所以另一個是?默認?)並且由於測試在另一個 package 中,因此找不到第二個 class。 所以情況基本上是文件 1 文件 ...
[英]How to find nested class arrow in staruml 5.0?
我使用 staruml 5.0.2.1570。 因為我不喜歡現代 web uml 圖編輯器。 我想使用 express 嵌套 class. 但我找不到箭頭來表達它。 但是我發現有人像下面這樣使用它。 我在哪里可以找到它? ...
[英]Resolving hidden Type Parameter in Java
考慮以下代碼:class Scratch<T> { class InnerClass<T> { public void executeHiddenMethod(){ //..some code to use Inner (T) type T r ...
[英]Infinite loop from access of improperly created variables
為什么這個 go 會進入無限循環,為什么會轉儲 char 0x20? 我發現了這個我正在玩內部類的惠斯特。 C++ 不是主要語言,我是從長期的中斷中來的,所以我問這個是為了提高我的知識。 我知道在正確創建 Outer 之前我不應該使用它,所以這通常是一件非常糟糕的事情。 我覺得真正的答案很可能只是 ...
[英]How can I determine whether a nested class is static in a Groovy AST transformation?
在 AST 轉換中,我試圖檢測 class Foo是否具有嵌套類,如果是,它們是 static 還是內部類: 當我檢查fooCn.innerClasses時, Foo$A和Foo$B都列出了。 ClassNode包括一個名為isStaticClass的方法,但通過 Javadoc,這僅告訴我嵌套 ...
[英]Accessing the outer class when inheriting from it
在此示例中, this指的是 class B , this@A指的是父 class。 如何訪問外部 class? 測試用例: ...
[英]How to iterate list of list on a condition and to return value in Map?
可用數據: 要求: 迭代classOneList並將值存儲在Map<Long, <ListLong>>中,僅當referencedNumbers包含ClassThree ClassOne的id作為“鍵”並將ClassTwo中的link作為“值”。 注意:它應該只使用流而不是 ...
[英]Im making a list with iterators and node classes nested in it but for some reason the iterator class is not making the list class a friend
創建了另外兩個 class 的塊和程序,程序包含塊列表。 實現了易於使用的迭代器,但無法通過列表 class 訪問其公共和私有成員。 錯誤是:class 列表沒有成員開始 E0135 開始:不是 class 列表的成員 C2039 在 vs22 ...
[英]Something I don't understand about Inner Classes
如果您想閱讀全文https://docs.oracle.com/javase/tutorial/java/javaOO/localclasses.ZFC35FDC70D5FC69D2693883A82EZ5A ,請查看以下鏈接那里寫着本地類和內部類共享它們都不能定義或聲明任何 static 成員,也 ...
[英]is it possible to implement a typescript abstract inner class?
如何在 typescript 中像這樣編寫抽象的內部 class? 這是我到目前為止所擁有的,但由於多種原因它不會構建。 有人可以指出如何將 java 版本轉換為 typescript 的方向嗎? ...
[英]keep specific inner class in android proguard
使用 proguard 時,如何在 android 中保留內部 class。 我有一個 classclass A{ public void setXX(B b){} public interface B{ } } 當我在 android 中使用 prouard 時,它會變成class A ...
[英]Unable to pass constructed var inv as a parameter to another function in same class
團隊:需要澄清:無法將構造的 var inv作為參數傳遞給同一 class 中的另一個 function。 我將第 6 行的參數作為teamInventory.parse_inventory(inv)傳遞,但它沒有被 parse_inventory 攔截誰能糾正我如何將 inv 傳遞給parse_ ...
[英]Unable to execute specific nested test class with Surefire
我對 Surefire 插件有一點小問題。 我有一個嵌套測試 class 層次結構: 我的目標是僅在其中一個嵌套類中執行方法。 不幸的是,我無法具體說明surefire(例如:僅執行testC2_m1() ),盡管這在 TestNG 和 IntelliJ 中都很容易實現。 我努力了: 甚至: 我什 ...
[英]Python: Inner Class
我正在嘗試從 class 創建 json 字符串,並且我將 class 定義如下: 我收到錯誤“TypeError: 'NoneType' object is not callable”。 是因為我自己將 OuterClass 定義中的 Header 和 Body 設置為 None 嗎? ...
[英]Modifying Outer Class attribute in with Inner Class Java
我想在主 class 中有內部類。 一個屬性是 innerClassId,我無法在內部 class 中更改它。 代碼: 它一直說“語法錯誤,插入“ClassBody”以完成 ClassDeclarationJava(1610612976)” ...