Skip to main content

All Questions

Tagged with or
16 votes
3 answers
899 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
201 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
2108 votes
28 answers
976k views

What is the main difference between an inner class and a static nested class in Java? Does design / implementation play a role in choosing one of these?
Omnipotent's user avatar
  • 28.3k
419 votes
12 answers
398k views

I'm trying to make a Tetris game and I'm getting the compiler error when I try to create an object Shape is not an enclosing class public class Test { public static void main(String[] args) { ...
V Sebi's user avatar
  • 4,333
398 votes
15 answers
215k views

I'm playing with lambdas in Java 8 and I came across warning local variables referenced from a lambda expression must be final or effectively final. I know that when I use variables inside anonymous ...
alex's user avatar
  • 11.4k
365 votes
11 answers
367k views

I have the following code: class Hello { class Thing { public int size; Thing() { size = 0; } } public static void main(String[] args) { ...
coolpapa's user avatar
  • 3,775
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
250 votes
6 answers
242k views

Can someone please point me towards some nice resources for understanding and using nested classes? I have some material like Programming Principles and things like this IBM Knowledge Center - Nested ...
bespectacled's user avatar
  • 2,959
389 votes
8 answers
299k views

What is the difference between static and non-static nested class?
Abhishek Sanghvi's user avatar
191 votes
16 answers
181k views

I have a situation like so... class Outer(object): def some_method(self): # do something class Inner(object): def __init__(self): self.Outer.some_method() # &...
T. Stone's user avatar
  • 19.5k
350 votes
3 answers
66k views

I have been reading some articles on memory leaks in Android and watched this interesting video from Google I/O on the subject. Still, I don't fully understand the concept, and especially when it is ...
Sébastien'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
291 votes
7 answers
184k views

I have the following code. I want to get hold of the outer class object using which I created the inner class object inner. How can I do it? public class OuterClass { public class InnerClass { ...
peakit's user avatar
  • 29.6k
149 votes
11 answers
167k views

I'd like to create a User Class for my new website. However, this time, I was thinking of creating it a little bit differently... Java, C++, and even Ruby (and probably other programming languages) ...
Lior Elrom's user avatar
  • 21.1k

15 30 50 per page
1
2 3 4 5
192