nested-class Questions
2
Solved
I have Class1 and class2 which is inside class1, VB.NET code:
Public Class class1
Public varisbleX As Integer = 1
Public Class class2
Public Sub New()
'Here GET the value of VariableX
End Sub...
Soothsayer asked 1/1, 2012 at 9:4
3
Solved
Constructors of non static member classes take an extra hidden parameter which is a reference to an instance of the immediately enclosing class. There is also a syntactic extension of 'new'. ...
Finalist asked 8/9, 2015 at 14:31
4
Solved
I have made an Outer and an Inner class. Both these classes have variable int x. How to access x of Outer class in inner class. this.x is not working.
class OuterClass {
int x,y;
private class Inn...
Iridosmine asked 28/4, 2015 at 6:37
3
Solved
class Outer(object):
class InnerBase(object): _var = {'foo', 'bar'}
class Derived(InnerBase):
_var = _var | {'baz'} # NameError: name '_var' is not defined
_var = InnerBase._var | {'baz'} # nam...
Liberticide asked 26/2, 2015 at 5:13
1
In the below code :
class EnclosingClass
{
public static class BiNode extends Sub.IBiLink { }
private static class Sub
{
private static class IBiLink
{
}
}
}
On compiling along...
Gastro asked 25/3, 2015 at 18:49
2
Solved
I'm at a loss as to how to explain why it is valid to create the member inner in the class template OuterTempl<T> whereas it is illegal to do so in the untemplated class Outer.
// Non-templa...
Celeriac asked 3/1, 2015 at 23:55
1
Solved
I'm having difficulty passing a pointer to the member function Outer<T>::foo to the constructor of the nested class Outer as shown below (see also ideone).
template<typename T1>
struct...
Inkling asked 17/12, 2014 at 22:57
3
I have a question regarding UML. I have a class which simply contains an inner class with the private access modifier - cannot be accessed from anywhere else... Normally in order to present an inne...
Cleavage asked 26/11, 2014 at 10:17
1
Solved
I came across a strange effect in connection with annotations on method parameters in a nested class. Looks very much like a compiler issue to me. See below for details and steps to reproduce.
Com...
Volans asked 27/2, 2014 at 10:20
2
Solved
How one can overload an operator<< for a nested private class like this one?
class outer {
private:
class nested {
friend ostream& operator<<(ostream& os, const nested& ...
Dab asked 10/11, 2011 at 15:44
2
Solved
Here, I was trying to implement a singleton class for my Database connectivity using the inner static helper class :
package com.myapp.modellayer;
public class DatabaseConnection {
private Dat...
Garry asked 7/8, 2014 at 21:29
4
Solved
I want to know how many instances of a static member class can be created by the enclosing class. I assume one only, but then the following extract from Bloch doesn't make sense to me.
Quoting Jos...
Dieldrin asked 25/7, 2014 at 10:14
2
I have a generic class X<T>; This class has a covariant part that I want to be able to access covariantly. So I factor it out into an interface IX<out T>. However, I want this interface...
Allegro asked 18/7, 2014 at 8:49
3
Solved
I tried snooping around for a similar question in the forum which could help me out without success.
I have a nested class in my C++ program. I am trying to access a variable of the parent class f...
Meunier asked 1/7, 2014 at 17:7
2
Solved
I have some code which looks like this:
namespace myLibrary
{
class A
{
public:
struct Nested
{
...
};
...
};
}
In some other parts of the code, I need to access A. Since I like readab...
Preposterous asked 24/5, 2014 at 17:22
4
Solved
I have a class A, which has a nested class B. Class A, will create n(run time parameter) instances of class B.
In the constructor of A, after computations that need to be made at run time, I compu...
Madalene asked 6/5, 2014 at 13:36
2
Solved
I have an abstract class like so:
class A
{
public:
void func() = 0;
};
Can I force its implementations to have a nested iterator class too?
#include <iterator>
template<typename T&g...
Glaucous asked 11/3, 2014 at 9:23
1
Solved
Suppose I have a variable x of type std::vector::iterator that was allocated (for other reasons) with placement new, e.g.
new((void*)&x) std::vector<int>::iterator();
How does one call...
Soricine asked 18/2, 2014 at 8:18
7
Solved
Which one is more acceptable (best-practice)?:
namespace NP
public static class IO
public static class Xml
...
// extension methods
using NP;
IO.GetAvailableResources ();
vs
public static...
Linkage asked 15/3, 2010 at 19:20
1
Solved
When a nested class in instantiated how does it reference the outer class? Does it always extend the outer class or reference it another way? I was told that the inner extends the outer but then wh...
Knopp asked 28/1, 2014 at 1:4
4
Consider the following code:
template < typename T >
struct A
{
struct B { };
};
template < typename T >
void f( typename A<T>::B ) { }
int main()
{
A<int>::B x;
f( x ...
Oscillation asked 3/11, 2010 at 22:29
2
Solved
I just came across a weird effect and while tracking it down, I noticed that there seems to be a substantial performance difference for collecting inner vs. static nested classes. Consider this cod...
Plop asked 4/12, 2013 at 16:25
1
Solved
I want to implement an algorithm as a class deriving from a pure virtual class representing the kind of problem the particular algorithm solves.
The general interface would look like this:
templa...
Connel asked 26/11, 2013 at 10:40
1
Solved
Is this code valid C++(11)?
struct Base {
template <typename>
struct nested;
};
struct Derived1 : Base { };
struct Derived2 : Base { };
struct Derived3 : Derived1, Derived2 { };
typedef D...
Lethe asked 14/11, 2013 at 19:1
3
Solved
Ok question title is far from being self-explanatory. I see myself doing this often:
From this answer:
public static class Equality<T>
{
public static IEqualityComparer<T> CreateComp...
Thanksgiving asked 18/4, 2013 at 11:57
© 2022 - 2024 — McMap. All rights reserved.