Skip to main content
Filter by
Sorted by
Tagged with
16 votes
3 answers
913 views

I have a function template f, defining in its body a local class A with another nested class B. Both classes are not templates. Must I name the inner class as typename A::B or shorter variant A::B is ...
Fedor's user avatar
  • 24.7k
Advice
2 votes
4 replies
249 views

Any C++ class can be first forward declared, and defined only later in the program. Are function-local classes an exception from this rule? Please consider a simplified program: auto f() { struct ...
Fedor's user avatar
  • 24.7k
7 votes
1 answer
202 views

In C++, forward declarations introduce an incomplete type. Incomplete types can be used to declare pointers, but they cannot be used to initialize values or access members because the complete ...
Connor Lawson's user avatar
0 votes
1 answer
79 views

Can nested classes or anonymous classes extend a class or implement an interface in Java? If so, are there any limitations or things I should be aware of? I'm not very familiar with nested classes, ...
coder12's user avatar
1 vote
1 answer
72 views

I have a nested class that uses static vars to have class wide parameters and accumulators. If I do it as a standalone class it works. If I do a nested class and inherit the standalone class, it works....
05032 Mendicant Bias's user avatar
0 votes
2 answers
58 views

Say, I have an abstract superclass and an abstract test class for testing subclasses. abstract class Superclass { } @RequiredArgsConstructor abstract class SuperclassTest<T extends Superclass> {...
Jin Kwon's user avatar
  • 22.4k
0 votes
0 answers
73 views

The following scala3 code compiles: trait Product trait Provider[+P <: Product] { def provide: P } class Outer extends Provider[Outer#Inner] { override def provide:...
Readren's user avatar
  • 1,290
2 votes
1 answer
45 views

I find an "Argument type mismatch" error in multiply function and don't know how to fix it. The code is: abstract class Semigroup<T1> { abstract val one: SemigroupElement<T1> ...
zplot's user avatar
  • 35
1 vote
1 answer
43 views

In the code you can see nested interfaces. The error in Intellij IDEA is: Kotlin: None of the following candidates is applicable: :25 The error is in the line: return Integer(this.value + other.value)...
zplot's user avatar
  • 35
1 vote
0 answers
69 views

suppose I have a template class template<typename T> struct Foo { struct Bar; }; specializing Foo<int>::Bar template<> struct Foo<int>::Bar { struct Private; // I ...
hczstev's user avatar
  • 93
0 votes
2 answers
49 views

NOTE: I'm not talking about the way of accessing the enclosing class FROM the inner class, that is not the problem at all. What I'm talking about is the following: class TopLevel { class ...
mipo256's user avatar
  • 3,366
-1 votes
2 answers
93 views

Java shouldn't allow static methods within an inner class and yet this code compiles and runs. How is this possible? class Test{ static int j=20; public void m1() { class Inner{ ...
abhay chanana's user avatar
1 vote
0 answers
57 views

I am looking to serialize a nested class on condition that value of an attribute is different than some custom value. I was looking at: https://devblogs.microsoft.com/dotnet/system-text-json-in-dotnet-...
KrumpiDumpi's user avatar
0 votes
2 answers
180 views

I am very curious about this question. The Java Language Specification has told me part of the reason: In a class instance creation expression for a non-private inner member class, §15.9.2 specifies ...
user24723440's user avatar
0 votes
1 answer
133 views

I have a class (MainApplication) that envelopes all my other classes, and an if statement that is outside of the outer class. I'm struggling to figure out how to access 'Start' from that if statement, ...
Goose's user avatar
  • 9
12 votes
1 answer
303 views

class A { private: int a; public: class B { public: B(int a) : b(a) {} int b; }; }; int main(void) { return 0; } clang (-Weverything) warns: t.cpp(10,15):...
albert's user avatar
  • 553
0 votes
0 answers
62 views

These are my entities: public class Order { [Key] public long OrderId { get; set; } public string CustomerId { get; set; } [ForeignKey("CustomerID")] [Required] ...
Hamidulla Orifov's user avatar
1 vote
0 answers
183 views

I have a Managed Record named TEmail with a nested private class called TEmailForm that inherits from TForm. The idea is my email Record can create a modal form as needed for the user to type an email....
dallin's user avatar
  • 9,514
0 votes
1 answer
76 views

The below is the Employee class which has a public static nested class called EmployeeNameComparator . import java.util.Comparator; public class Employee { public static class ...
Shermukhammad Karimov's user avatar
-3 votes
1 answer
45 views

I have this simple application to populate fields from a data model, The data model is called Order which has a nested class called Address. When I attempt to assign a value to Order.Address.city, I ...
Jake_ss's user avatar
1 vote
2 answers
145 views

I want to write code, that can do following: Create 9*9 GridPane board that filled with 81 StackPanes. When I click on cell (StackPane) I want to change color of background StackPane to blue if it ...
Andrey L's user avatar
0 votes
0 answers
50 views

Consider the following C++ code: #include <iostream> #include <memory> template<typename T> class MyClass { public: struct InnerStruct { ...
Setu's user avatar
  • 1,086
-1 votes
1 answer
126 views

simpleJDBCCall.returningResultSet("test", new RowMapper<SomeObject> { @Override public SomeObject mapRow(Resultset r, int i) throws sqlexception { //-----some code---- return ...
H1312's user avatar
  • 23
2 votes
0 answers
81 views

I was completely blown away after I made a static member in Method local inner class, I am wondering what might be its use case as the scope of MLIC member is only inside the method in which they are ...
Chetan Sharma 417's user avatar
0 votes
0 answers
70 views

I'm trying to write some Kotlin code to encapsulate the idea of fields and elements in a field (with a view towards doing some work with finite fields). I'd like the classes to be tightly coupled ...
Sebastian's user avatar
  • 803
0 votes
1 answer
84 views

I'm attempting to access a method inside a nested class that my class extends. Specifically, it's the getSenderSubID() method in quickfix.fix42.Message.Header. public class ExecutionReport extends ...
avlclimber's user avatar
0 votes
0 answers
70 views

I'm trying to use a macro to save the code used to create a function for pretty-printing. Except the function is used in the constructor of an inner class. I had this working when the class was ...
Todd O'Bryan's user avatar
  • 2,278
0 votes
2 answers
102 views

I would like to understand Python classes and objects. I am trying and struggling to get the output results from inner-class, Features. class Person: def __init__(self): pass def ...
Motchello's user avatar
1 vote
1 answer
73 views

I'm trying to get the C# equivalent of this Kotlin code: class Baz<E>(val value: E) class Foo<T>(val toto: Baz<T>) { class Bar<U>(toto: Baz<U>) : Foo<U>(toto) ...
Vinccool96's user avatar
-1 votes
2 answers
120 views

I have a number of situations where I need to mutually reference nested classes e.g. class C1; class C2; // class C2::S; // not allowed by the standard template <class T> class R { T* t = ...
Rob190's user avatar
  • 73
0 votes
0 answers
51 views

I am trying to overload the stream insertion operator << to allow instances of my gml::tensor<T>::shape class to be printed to stdout. I have reduced my code as much as possible in order ...
Gregor Hartl Watters's user avatar
0 votes
1 answer
63 views

Is it possible to specify a parameter of an inner class function as being types as another inner class? class MyClass(): class InnerClass1(): pass class InnerClass2(): ...
jpo38's user avatar
  • 21.9k
1 vote
1 answer
91 views

I'm trying to create a Child class within a Person class, but am having trouble accessing the child object after creation, when more than one instance is created dynamically. For example, I ask the ...
LBJ33's user avatar
  • 459
0 votes
0 answers
61 views

say I have these two classes in a single file where class A is a top level class: class A{ class B{ } } how to make another top level class, say class C, extend class B without making B ...
kaka's user avatar
  • 845
1 vote
2 answers
701 views

I have a class data classOuter ( val str: String = "fOo" ... val innerClassInstance: InnerClass= InnerClass(), ) { ... inner class InnerClass { fun foo () { ...
gstackoverflow's user avatar
1 vote
1 answer
119 views

"You cannot declare an interface inside a block; interfaces are inherently static" This is sentence from https://docs.oracle.com/javase/tutorial/java/javaOO/localclasses.html#local-classes-...
kaka's user avatar
  • 845
0 votes
1 answer
156 views

So basically I have a abstract class representing a BinaryTree below. I want to create a subclass called RBTree which will take advantage of all the abstraction in BinaryTree including the ability to ...
Luke Abruzese's user avatar
2 votes
1 answer
43 views

I have the following code: class Foo { static { //static initializer block System.out.print("Foo"); } class Bar { static { //static initializer block ...
Sy Pham's user avatar
  • 109
2 votes
3 answers
2k views

How would a UML diagram look like for the case of the class containing structs which only exist during the life-time of the class? Disclaimer: I saw that there are similar questions, but mine differs ...
spaceKelan's user avatar
2 votes
1 answer
96 views

I want to use inner classes (mainly dataclass and Enums) to keep things encapsulated. They hold data and defines that are only relevant to the main class, so I'd like to keep them inside it. I get the ...
user13722095's user avatar
2 votes
0 answers
313 views

Salut community, I had a problem with leaking memory in some code of mine and posted a question on this board (Issue with python memory management). Through some inspection I found what I had to ...
chriss's user avatar
  • 173
0 votes
2 answers
122 views

So I googled everywhere and cannot get a straight answer to my problem. I haven't touch C++ in a while so I wanted to approach a minimalist coding structure, but I ran into a problem. I have a parent ...
Moorease's user avatar
1 vote
0 answers
50 views

Is it possible to define an extension method for an inner class? The syntax reference seems to show it is possible to have a UsingParamClause before the DefParam, which is promising, and motivates the ...
Maximilien Tirard's user avatar
-2 votes
2 answers
793 views

I was reading the articles regarding the inner classes and out of curiosity I declared the static members within the inner class. Strangely no compile time error was shown and the code just executed ...
Rishi Bharadwaj's user avatar
1 vote
1 answer
758 views

I'm targeting a non-static nested class, e.g. package whatever; class Outer { public int x; class Inner { public void foo(); } } And I would like to write a SpongePowered Mixin ...
Zachary Barbanell's user avatar
0 votes
2 answers
123 views

Consider the following class: public class DataStructure { // Create an array private final static int SIZE = 15; private int[] arrayOfInts = new int[SIZE]; public DataStructure()...
YoavKlein's user avatar
  • 2,885
1 vote
2 answers
130 views

import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java....
HarshSinha_7's user avatar
0 votes
2 answers
72 views

I have a nested class and I would like it to have access to the attributes of the outer class. I've seen this done on other SO topics (here and some others). However, they always give a reference to ...
Unemployed Goose's user avatar
2 votes
1 answer
140 views

I have a Top-level public class with an inner class being created in that same class by creating an instance of the top-level class and then creating an instance of the inner class in that instance of ...
George S.'s user avatar
0 votes
0 answers
151 views

class Outer { static void out() { System.out.println("hello world"); } static class Inner { } static void main(String[] args) { //Intellij Note: No ...
Hai Shi's user avatar

1
2 3 4 5
59