Questions tagged [outer-classes]
49 questions
0
votes
0 answers
Introducing new member function to an outer class of a reusable header leading to failure in loading components which utilizes it
I have a reusable header which is consumed by multiple components. I introduced a member function and a member variable to the outer class and called it from one component. The implementation of the function was done in the .cpp of the reusable…
0
votes
1 answer
Accessing outer-class fields through inner-class instance from outer-class
This is a short subquestion of a larger question I am working towards to.
Why can't I access the outer classes field through an instance of inner class in outer class in line 8?
The field is visible from inner class.
The problem persists for…

Malte
- 75
- 7
0
votes
1 answer
Why does javac create an additional class?
I have compiled the following code (Methods and variables are elided for brevity):
// Outer.java
public class Outer
{
private class Inner
{
}
void someMethod()
{
Inner inObj = this.new Inner();
}
public static…

Seshadri R
- 1,192
- 14
- 24
0
votes
1 answer
Is thread safe calling outer class variable?
public class Status {
private Scheduler scheduler;
private volatile Boolean lastResult;
public Status() {
scheduler = new Scheduler();
scheduler.everyTenSeconds(new Action());
}
public boolean isSth() {
…

jnr
- 121
- 5
0
votes
1 answer
Qt C++ inner class access to outer class
I have a question again:
I have a class PBV t(inherits from Tab) hat has a class Geometry. Geometry is the parent of Geo_1. From Geo_1 I want to have access to methods of PBV ( e.g. printContent . How do I do that? I am able to create Signal-Slots…

user3443063
- 1,455
- 4
- 23
- 37
0
votes
1 answer
Java method not working in nested classes
I have 1 outer class with 1 inner class like this:
public class Outer extends PircBot {
...
public class Inner extends SessionAdapter {
...
}
}
Inside that Inner class I am trying to invoke a method called sendMessage(..) which is inside…

Faraz
- 6,025
- 5
- 31
- 88
0
votes
2 answers
In case of inner and outer classes, Java
There was one MCQ ( Multiple Choice Question ) while I was reading my Java study book and that MCQ is:
Question : In case of inner and outer classes, _________
Options are :
(a) The members of outer class can not be accessed by inner class.
(b) The…

Natha Odedara
- 206
- 3
- 9
0
votes
4 answers
Access object created in innerClass from elsewhere java
so i have outerClass and innerClass, and i want to access the object created from innerClass using outerClass, example:
public Class outerClass{
Class innerClass{
//properties
}
}
so what i want to do is something like this:
public…

nikagar4
- 830
- 4
- 11
- 23
0
votes
2 answers
How to Store in Global Variable from local variable?
At the last Toast, It will print blank Toast.Why?
I am passing local variable to a global variable and thus printed it. Why Java does not allow this? And What is the Solution Of this?
Here is the code...
String sb_temp=" "; //global…

Ankur_009
- 3,823
- 4
- 31
- 47
0
votes
3 answers
Create Instance of a Class that is Used in the Constructor of its Outer Class
I'm trying to create an instance of a class that is used in the constructor of its outer class. Referring to the code below, I need a UserData object but I also need a TimeOnlineInfo object to create it, and I don't see a way of getting…

kmecpp
- 2,371
- 1
- 23
- 38
0
votes
1 answer
Java outer-class access to inner-class interface constants
Excude me if this is a dumb question.
I have a "Fragment" outer-class with and inner-class interface. This interface is only implemented by one other Activity-class using "implements OuterFragment.ParentActivityListener".
I would like to have a few…

Koniak
- 484
- 1
- 4
- 13
0
votes
0 answers
DialogFragment - make it as a member of the outerclass instead of static inner class
this is a small example from Android tutorial showing a DialogFragment and DatePicker.
Its implemented as a static inner class of the MainActivity. I wonder if its possible to change the code so that it becomes a member-function of MainActivity…

user3155478
- 975
- 1
- 10
- 16
0
votes
4 answers
Have C++11 some portable and effective way to access enclosing class from nested class?
What I am needing can be done by storing this pointer of enclosing class into nested class for example this way:
class CEnclosing {
public:
class CNested : public CSomeGeneric {
public:
CNested(CEnclosing* e) : m_e(e) {}
…

user3123061
- 757
- 5
- 14
0
votes
3 answers
How to change variable value throughout outer class when it changed in an inner one?
I have a swing class that includes a String variable str3 declared as final and two
ActionListener interfaces that implemented by two JButtons b1
and b2 , when b1 JButton is pressed str3 String takes a value ,
My question here how to…

PHPFan
- 756
- 3
- 12
- 46
0
votes
1 answer
Access variable update in inner class from outer class in Java
I have declared some variables in outer class and trying to get the value of this variables from inner class and do some operation on this variables in a method in outer class. I am sharing here how I am trying to do it through some sample code.…

MSIslam
- 4,587
- 6
- 25
- 28