Questions tagged [private-class]

Use this tag for questions related to building or using private classes.

25 questions
12
votes
1 answer

Java programming idiom : Private implementation class

I found this construct in some code. Is there any benefit to have a private static class implement A? This reminded me of the Pimpl idiom in C++. Is there any benefit to using the Pimpl idiom in Java? public abstract class A { public void…
Chip
  • 3,226
  • 23
  • 31
11
votes
2 answers

How to implement private inner class in Ruby

Coming from Java, I am trying to implement LinkedList in Ruby. The usual way I would implement this in Java is have an class called LinkedList and private inner class called Node with each object of LinkedList as Node object. class LinkedList …
WastedPandoo
  • 153
  • 1
  • 10
9
votes
1 answer

Why can't ButterKnife bind fields that are in private inner classes?

In a fragment, I have a button that opens up a PopupWindow. private class onMenuClickListener implements View.OnClickListener { @BindView(R.id.popup_radiogroup) RadioGroup popupRadioGroup; @BindView(R.id.popup_textview) TextView…
ranys
  • 256
  • 2
  • 9
5
votes
5 answers

What is the preferred way to organize callbacks?

In my Android project, I define a few callbacks to operate on button clicks, connectivity events, or UI events such as Dilaog.onShow(). For demo purposes, I have chosen a Runnable interface that must be launched from some Activity code. With Java, I…
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
5
votes
1 answer

Using pydoc for non-public/private classes

When I use _ as a prefix for a class name (see also this and this), the class becomes non-public and is not displayed by pydoc: class _DoNotShowMeInPydoc: """Class Documentation which is not displayed""" That's just what I want, because…
zonksoft
  • 2,400
  • 1
  • 24
  • 36
3
votes
1 answer

Access private class or function from other file in flutter

I create a widget that have many part. So, it is not good practice to create this widget in one file. So that, I rearrange in many file. I make private these widgets(part), so that, these can't be accessed in other file. I want to access these…
Prantik
  • 67
  • 1
  • 4
3
votes
5 answers

Do private classes need to be accessed by properties?

I am using an instance of a private class as the state object supplied to a stream.BeginRead operation. (The class is private to my main stream reading/writing class.) public class MainClass { // ... private class ResponseState { …
Andy
  • 5,188
  • 10
  • 42
  • 59
3
votes
1 answer

How to access Java object functions from nashorn

I would like to make an interface that will allow users to supply arbitrary filter functions to process records in a Java application. I decided to use Java Scripting utilities for this, specifically nashorn and JavaScript. My problem is that when…
Kyle
  • 401
  • 4
  • 10
3
votes
5 answers

JAVA - Beginner - Can a private class attribute be accessed outside of the class?

I am relatively new to Java OO Programming, and have reviewed the questions similar to this, although they don't seem to answer my question directly. Basically, I understand that if a data member within a class is declared as private, then it is…
AlexM
  • 133
  • 2
  • 3
  • 17
2
votes
2 answers

private class calling a method from its outer class

Ok, so I have a class for a "Advanced Data Structure" (in this case a kinda tree) SO I implimented a Iterator as a private class with in it. So the iterator needs to implement a remove function to remove the last retuirned element. now my ADT…
Frames Catherine White
  • 27,368
  • 21
  • 87
  • 137
1
vote
3 answers

How can I test if a private method of a class is called or not with rhino mock?

I am quite new at C# and also rhino mocks. I searched and found similar topics with my question but couldnt find a proper solution. I am trying to understand if the private method is called or not in my unit test. I am using rhino mock, read many…
SSanc
  • 13
  • 4
1
vote
2 answers

Two private subclasses to one public class

I got a C# project where I need to have a base class and two sub classes and I want the sub classes to be private to the base classes. This is how it looks like: public class MyBaseClass { public void doMyWork() { doSubClass1(); …
Rene Nielsen
  • 87
  • 1
  • 7
0
votes
2 answers

Is this construct a proper use of a private class, and how do I put its instances in that map?

Trying to find a somewhat clean design for sampling billions of dice rolls and while my first ugly solution did work by just creating the generators for the known ranges (dice) it was an ugly mess of multiple typed out by hand copies only changing…
Erik Itter
  • 103
  • 3
0
votes
1 answer

Can I reference a non static member to a private string array in a class? C++

I'm trying to have three private data members (string firstName[], string lastName[], and float testScores[]) in a class where the number of elements is an input from a public data member, totalStudents (which is user defined). Further, adding const…
0
votes
1 answer

How do we hide private class when using it in Objective-C?

Question How do we hide private class when using it in Objective-C? For example, as described below PrivateFilter is the class I want to hide. CustomFilter is the class I make, which is open. GPUImageFilter is the class public on Github, which is…
allenlinli
  • 2,066
  • 3
  • 27
  • 49
1
2