
[英]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)” ...