Skip to main content
Filter by
Sorted by
Tagged with
2 votes
2 answers
98 views

This is an attempt to make an alias to an anonymous class: struct { int i = 0; } a; // error C7626 in MSVC using A = decltype(a); This produces an error in Visual Studio: error C7626: unnamed ...
Fedor's user avatar
  • 24.7k
0 votes
1 answer
77 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
0 votes
1 answer
88 views

I have a Trait called HasDefault its main purpose is to ensure that the class has a static field $default which is callable and returns the default instance of the class using the Trait This is what ...
LordF's user avatar
  • 536
2 votes
1 answer
54 views

Consider the following clause from JLS 8: § 15.9.5.1. Anonymous Constructors Note that it is possible for the signature of the anonymous constructor to refer to an inaccessible type (for example, if ...
theutonium.18's user avatar
1 vote
1 answer
47 views

The following code compiles and runs in Scala 2: trait SomeTrait { val myName: String } class SomeClass() extends SomeTrait { override val myName: String = "Billy Banana" } val ...
Joe PP's user avatar
  • 93
0 votes
3 answers
87 views

Thanks to the answers to this question I am able to override a virtual method in C# when I extend a class into a kind of anonymous type. But is it possible to refer to a class variable or property of ...
Gianpiero's user avatar
  • 3,587
1 vote
0 answers
69 views

Anonymous classes (a.k.a. anonymous types) are implicitly created and used by the C# compiler for code like this: var obj = new { X1 = 0, X2 = 1 }; They have value equality semantics, i.e., the ...
Bartosz's user avatar
  • 601
0 votes
2 answers
122 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
0 votes
0 answers
16 views

I have some class with "complex" objects like Enumerators, Lists and others. I need to construct the same anonymous object from instance of this class. However, I need to convert all ...
renathy's user avatar
  • 5,385
0 votes
1 answer
41 views

Here is a problem I face when maintaining and old application, below are the code for demonstration: First, I created a class with field innerComp valued by instance of an anonymous class and a field ...
Tel lui's user avatar
  • 109
0 votes
1 answer
42 views

I'm stuck on this question where we need to instantiate the C class through A class A{ static class B{} static class C{ B b; C(B b){this.b=b;} int foo(){return 42;} } } public class ...
acidic231's user avatar
1 vote
1 answer
120 views

Names of anonymous classes are generated by concatenating the outer class name with a $ and a number, so e.g. anonymous classes within a class Foo may be generated as Foo$1, Foo$2, etc. I have made ...
WilliW's user avatar
  • 13
2 votes
2 answers
206 views

Trying to make a file downloadManager we have a activity which contains recycler view, each item in recycler view represents a file which is either in downloading, downladed state. Each recycler view ...
JSONParser's user avatar
  • 1,130
0 votes
2 answers
429 views

Anonymous class definition is An anonymous class is a synthetic subclass generated by the Scala compiler from a new expression in which the class or trait name is followed by curly braces. The curly ...
Talos's user avatar
  • 478
4 votes
1 answer
426 views

Is there any difference between those two ways to write the same thing? int? foo = GetValueOrDefault(); var obj = new { //some code..., bar = foo.HasValue ? foo > 0 : (bool?)null } VS int? ...
Federico's user avatar
-1 votes
1 answer
76 views

I am writing automated tests, and I want each to retry twice. So I wrote a method: public void retry(int retries, Retryable retryable) { for (int i = 0; i < retries; i++) { ...
hetacz's user avatar
  • 149
0 votes
0 answers
129 views

I am trying to instantiate an anonymous class via a factory function. Unfortunately for me, the function returns the exact same class for each call, which is getting me in trouble while using static ...
guyshitz's user avatar
1 vote
2 answers
218 views

I am trying to reset the timer so it can pull another value from my array. Does anyone know the solution? My error is saying: peat = peat= 1; local variables referenced from an inner class must be ...
Javier Salazar's user avatar
-3 votes
1 answer
336 views

There is something surprising in the following code. The ListCell class is not abstract, but we were able to create an anonymous class from it and override its method! How is this possible? ListCell&...
vorxd's user avatar
  • 35
2 votes
1 answer
111 views

I have an interface called ClientRegistrationListener public interface ClientRegistrationListener { void onClientAdded(Client client); } And I also have in the main class an ArrayList of ...
Corina M's user avatar
  • 152
0 votes
1 answer
138 views

I have a problem regarding anonymous objects in C#. The situation is as follows: I have a C# web app which does NOT use the traditional ASP.NET Razor engine, but instead uses the RazorEngine open ...
dabs's user avatar
  • 747
1 vote
1 answer
44 views

There are 3 method signatures in a Phone interface, all of which were implemented in the anonymous class definition for a smartphone. However, I want the anonymous class to have another method that is ...
Nirvan-StackOverflow's user avatar
0 votes
2 answers
4k views

I'm using JUnit 5, and copied the code from "Software Testing" book in order to create a mock object for testing. part of the tester code is: @Test public void ...
Soory's user avatar
  • 1
2 votes
0 answers
39 views

Java: In this method, compiler gives error "Variable used in lambda expression should be final or effectively final": void javaAnonymousClass(Button button) { String localVar = "10&...
soshial's user avatar
  • 6,908
2 votes
1 answer
424 views

I'm confused by many websites: People there refer to a class/struct as Anonymous when it has no name for example: struct{ int x = 0; }a; I think the example above creates an Unnamed struct but not ...
Itachi Uchiwa's user avatar

1
2 3 4 5
15