Top "Anonymous-class" questions

An anonymous class is a local class without a name.

Cast to Anonymous Type

I had the following problem today, and I was wondering if there is a solution for my problem. My idea …

c# anonymous-types anonymous-class
Is there a way to convert a dynamic or anonymous object to a strongly typed, declared object?

If I have a dynamic object, or anonymous object for that matter, whose structure exactly matches that of a strongly …

.net c#-4.0 anonymous-class dynamicobject
Setting outer variable from anonymous inner class

Is there any way to access caller-scoped variables from an anonymous inner class in Java? Here's the sample code to …

java anonymous-class
Can I specify a meaningful name for an anonymous class in C#?

We all know that when we create an anonymous class like this: var Employee = new { ID = 5, Name= "Prashant" }; ...at run …

c# .net c#-3.0 anonymous-class
Can we create an object of an interface?

interface TestA { String toString(); } public class Test { public static void main(String[] args) { System.out.println(new TestA() { public String …

java oop interface instance anonymous-class
How do I use Powermockito to mock the construction of new objects when testing a method in an anonymous class?

I woud like to write a JUnit test to verify that the code below uses a BufferedInputStream: public static final …

java mockito anonymous-class powermock object-construction
Access "this" from Java anonymous class

Given the following code: public interface Selectable { public void select(); } public class Container implements Selectable { public void select() { ... } public void …

java this anonymous-class
Can I create anonymous classes in C++ and capture the outside variables like in Java?

In Java, when I need a callback function, I have to implement an anonymous class. Inside the anonymous class, I …

c++ c++11 lambda anonymous-class
Anonymous vs named inner classes? - best practices?

I have a class, let's call it LineGraph, that renders a line graph. I need to subclass it, but the …

java oop class inheritance anonymous-class
C#: Creating an instance of an abstract class without defining new class

I know it can be done in Java, as I have used this technique quite extensively in the past. An …

c# abstract-class abstract anonymous-class