Questions tagged [outer-classes]

49 questions
1
vote
1 answer

How to get a variable's value from a registerReceiver inner class

Hi I am writing an application for Android. I use Android Studio 2.1 and Android 4.0.3. My application uses Wi-Fi data and I can not get a variable's content from outer class. I am using registerReceiver and I try to get a variable in that register…
user5605248
1
vote
2 answers

How to access outer outer class(not outer class) property?

For example,if A has inner class B,B has inner class C,all have a property "name",I know C can access name in B by B.this.name,but how to access name in A from C? public class A{ String name="A"; public class B{ String name="B"; …
ggrr
  • 7,737
  • 5
  • 31
  • 53
1
vote
5 answers

Arrays with outer and inner classes

I am relatively new to Java. I wanted to create an arraylist of an outer class and for each index of the outer class of the arraylist I want an arraylist of inner classes. public Outerclass{ //Code Here public InnerClass{ //Code Here …
user2604504
  • 697
  • 2
  • 14
  • 29
1
vote
1 answer

How does extending outer class works in java

Referring to the code in this Question I wanted to how know does the extending of an outer class works. What I mean is How can a class (the inner class) can have its definition at two places (in the outer class due to being inner class and in itself…
me_digvijay
  • 5,374
  • 9
  • 46
  • 83
1
vote
1 answer

Get address of a non-POD object from within a data member, which is a single-use nested class

I'll start with some code: class myNonPODClass { public: virtual ~myNonPODClass() {} class { public: myNonPODClass* GetContainer() { return (myNonPODClass*)((int8_t*)(this) - offsetof(myNonPODClass,…
Brent
  • 4,153
  • 4
  • 30
  • 63
0
votes
3 answers

Java - Array of Inner Classes inside of Outer Class

Let's say I have: public class A { public A() { ... } ... public class B { public B() { ... } public void doSomething() { ... } ... } public class C { public C() { ... } public void…
Wex
  • 15,539
  • 10
  • 64
  • 107
0
votes
1 answer

Outerclass with its innerclass as an argument for the outerclass constructor

Im wondering if it is possible to create this object based on the code below or is it a cyclic dependency which cant be solved? public class A { private B b; public A(B b) { this.b = b; } public class B { public B() {} } } I…
freeze
  • 13
  • 1
0
votes
0 answers

Python : What is my mistake in my inner class to set the init method?

I have an Uuter class with few instaces variables and i want to set one to the Inner class. The code : class AutoComplete : def __init__(self, ocr_all_doc_text , pdf_id, connection ) : self.ocr_text = ocr_all_doc_text …
Goncalves
  • 159
  • 9
0
votes
1 answer

Is there a difference between the way Inner class access Outclass methods and properties?

I have encountered two ways: Where in the code of the Outer class we are creating (by new keyword) the Inner class we can send to the Inner class constructor an instance to his Outer class (using this keywords). This way can be found in ArrayList…
Eitanos30
  • 1,331
  • 11
  • 19
0
votes
1 answer

Must an inner class use 'this' keyword in order to use outer class method or attributes?

I'm reading the source code of ArrayList and this class has an inner class with the name SubList. I'm looking in a method of the inner class (SubList) and see the following methods: public E set(int index, E e) { rangeCheck(index); …
Eitanos30
  • 1,331
  • 11
  • 19
0
votes
0 answers

How to create object of second level inner class?

Lets say I have an outer class called 'Foo' and inside 'Foo' class I have a nested inner class called 'Bar'. Now inside 'Bar' class I have another inner called 'Choo'. What I want to do is create an instance of 'Choo' class from a method inside…
Jos
  • 11
  • 5
0
votes
0 answers

Alternative for an inner class, which is instantiated inside the outer class

I am working with a big Java class MainAgent which has several inner classes, and altogether they make a 1500+ code lines, which makes maintainance of this class so hard. I need to replace these inner classes with saperate normal outside classes and…
LSampath
  • 138
  • 1
  • 3
  • 11
0
votes
0 answers

Getting all instances of an inner class from an instance of its outer class

Let's say a Tree class has in inner Node class. class Tree { ... class Node { ... } } I know that within the context of a Node instance, the outer instance, or the "owner" of the Node can be accessed using the qualified…
SMMH
  • 310
  • 1
  • 13
0
votes
1 answer

what is the meaning of parentheses with inner and outer classes?

why there is no parentheses with outer in print statement and what's that mean? class outer() { var name = "mr X" class nestedclass { var description = "Inside the nested class" var id = 101 …
0
votes
1 answer

Python: Get outter class off of an inner class object

I have a setup like below where B is an inner class and A is an outer class: class A: # some A stuff class B: # Some B stuff If I have a B instance: b = B() How can I get class A? In other words, I want something like type(b) which…
Ali
  • 183
  • 1
  • 7