Questions tagged [private]

Private is a way of encapsulation in object-oriented programming.

Private is a way of encapsulation in object-oriented programming.

2890 questions
1
vote
1 answer

How do I put private in front of many variables at once in android studio?

public class Page7 extends Activity { ImageView forward ; ImageView backward ; ImageView mayatnik; ImageView pic2 ; ImageView pic3 ; long milliseconds_per_second = 150 ; ArrayList birds ; ImageView bird0…
ERJAN
  • 23,696
  • 23
  • 72
  • 146
1
vote
2 answers

Why can a private class method be explicitly invoked in Ruby?

As we know, the private methods cannot be called with an explicit receiver in ruby. But when I define a class, I can invoke a private class method by the class itself. For example: class A private def self.test puts "hello,world!" …
pangpang
  • 8,581
  • 11
  • 60
  • 96
1
vote
1 answer

how to create in PHP analog of C# ' private const int ' and ' private const byte '?

So in C# I create something like private const int HEADER_LENGTH = 13; private const byte SIGNATURE1 = 0x46; How to create its analog in PHP?
Rella
  • 65,003
  • 109
  • 363
  • 636
1
vote
3 answers

Calling private event handler from outside class

i've two classes. One class (say A) takes a textbox in c'tor. and registers TextChanged event with private event-handler method. 2nd class (say B) creates the object of class A by providing a textbox. how to invoke the private event handler of…
Azodious
  • 13
  • 3
1
vote
2 answers

What will be the proper assigning of variables (private and shared) in the parallelized do loop of the given subroutine GAUSSLEG?

I am new about openmp. I am trying to parallelize do loop in subroutine GAUSSLEG. Variables Xg, Wg and Ng are taken from module matric. I am getting the unexpected results. I am confused about proper assigning of variables(private and shared). Can…
1
vote
1 answer

.valueOf using another class's private variable

BaseExample Class (I am not allowed to make the variable protected on this example): public class BaseExample { private int a; public BaseExample(int inVal) { a = inVal; } public BaseExample(BaseExample other){ a =…
userb
  • 173
  • 2
  • 15
1
vote
1 answer

Accessing parameters of the same name of different classes in Scala

I have a very specific scenario, in which I have some different abstract classes the have child case classes that can have different parameters, for example: abstract class ball() {} case class football(_name: String, _shape: String) extends…
Sheenah
  • 85
  • 12
1
vote
2 answers

How is it that I am able to reference private fields of an instance inside a class?

I have had a look for an explanation but haven't been able to find one. Why does this code work? Specifically - why can the private members of an instance be accessed? As far as I know it only works when the instance is created in a method inside…
bozzle
  • 1,106
  • 9
  • 9
1
vote
1 answer

Implementing: private structs in Class

I have a List class which uses two objects: Element & Iterator I considered making Element & Iterator classes but decided on structs. V1. This works... template struct Element template struct Iterator template
tuk
  • 367
  • 1
  • 4
  • 10
1
vote
2 answers

How do i call an array from private methods?

so, i have to make an application that creates results, i have completed everything, I think???? but i dont know how to get me private method outputData to output the array results from the private method getValue. This is what i have //…
1
vote
0 answers

How to use the Diffie-Hellman parameters for generating a private and public key pairs:

I need to generate private and public key pairs from this information provided, my question is: I need to put this in a file with extension .pem for creating the private and pu blic key using openssl? "Diffie-Hellman-Parameters: (1024 bit) Prime…
Cibercop
  • 11
  • 1
1
vote
3 answers

static and private method behavior when calling direct on object of child class sounds like overriding?

public class B extends A{ public static void main(String[] args) { new B().privateMethod();//no error -output B-privateMethod.Sounds like overriding new B().staticMethod(); //no error -output B-StaticMethod.Sounds like overriding …
user4768611
1
vote
0 answers

Detect if user is browsing in private mode

I know there are already other threads dealing with this very topic. But most of them are already a few months old and their common conclusion seems to be: "It's not possible to detect if a user is browsing in private mode or not." Yet some days ago…
Stefan Surkamp
  • 972
  • 1
  • 16
  • 31
1
vote
1 answer

Javascript simulate real private variable and manage it with getter/setter

Do I use correctly simulation of private variable with this way? var C = function(a) { var _private = a + 1; // more code... Object.defineProperties(this, { 'privateProp': { get: function() { return…
Alex_wd
  • 13
  • 3
1
vote
1 answer

Java private method wrapping

I have seen the following pattern used in several frameworks, where a private method is wrapped in a public method: public Object method_public() { return method_private(); } private Object method_private() { return Object; } What is this…
sotn
  • 1,833
  • 5
  • 35
  • 65