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

Having a reference be changed without explicitly changing its reference

I've been learning Java over the past year and I've gotten fairly proficient with data structures, but there's something that's always been on my mind that I've never quite figured out. The following is an example: public class SList{ private…
Iche
  • 145
  • 2
  • 8
1
vote
1 answer

Cloud foundy - Discovering backend application without public route

I'd like to implement micro service architecture on CF (run.pivotal.io) and have problems with creating my private backend services. As I see I have to options at deployment: with and without route. With route my services becomes public which is ok…
Peter Borbas
  • 158
  • 6
1
vote
2 answers

Why doesn't PHP permit private constants?

Why doesn't PHP permit private constants? I am aware that there are workarounds, such as using a private static property instead. However, from an OOP or software design perspective, what was the reasoning?
Leo Galleguillos
  • 2,429
  • 3
  • 25
  • 43
1
vote
3 answers

Proper way to use private class for a linked list

I'm studying data structure. While studying a linked list, I wonder if this is good practice or not. Here is my code: class LinkedListStack { // <-- Node private class Node { // I made a private class! private int data; …
KimchiMan
  • 4,836
  • 6
  • 35
  • 41
1
vote
1 answer

Macro to create activex command button and assign a macro to that button

i need a help here, i'm creating a code and one of it's functions will be to create a activeX command button but i need the code to create the button and assign the macro "Sub graft()" to it So i need the macro to create the activeX button…
Ygor Yansz
  • 176
  • 1
  • 4
  • 12
1
vote
1 answer

Accessing private members from other classes

In Java, if two classes are defined inside one top-level class, they have access to each other's private members (fields, constructors, methods). So in a situation like the following you could use all of the private members of ClassA inside ClassB,…
Paul Boddington
  • 37,127
  • 10
  • 65
  • 116
1
vote
2 answers

Can I in Scala declare the class inside its companion object?

While fighting with my private immutable class constructor, and the constraint that auxiliary constructors have to call each other as first statement, without anything else from the class in scope, I seem to be constrained to use a companion object…
Nirvana
  • 93
  • 1
  • 6
1
vote
1 answer

Hide helper methods in Ruby mixin

A Ruby module used for logging is being used almost in every class as a mixin. Therefore it must contain as low public methods as possible to avoid name collisions. The problem is that each public method uses the same helper methods and they become…
Paul
  • 25,812
  • 38
  • 124
  • 247
1
vote
1 answer

Xcode project complains about missing files if a linked framework contains private headers

My problem is this: My framework contains public and private headers - the public headers import private headers in the framework My app that links against this framework imports public headers Now when I compile it, Xcode complains about missing…
jhoff
  • 100
  • 1
  • 10
1
vote
2 answers

How to use structs declared private?

I'm working on a project with a pre-made .hpp file with all the declarations and stuff. A struct is declared in the private part of the class, along with some private members. I need to create an array with the type of the struct in my .cpp…
Daniel
  • 21
  • 1
  • 1
  • 2
1
vote
1 answer

How can I use private functions[mllib] in my code?

I started working with spark, specifically with mllib library. several of the functions are limited in scope and private statements. How can I use these functions in my code? Example: KMeans.scala private[mllib] def pointCost( centers:…
1
vote
1 answer

Discards qualifiers Error accessing a vector of a map in a class?

I have a class defined as follows in the .h: #ifndef C1_H #define C1_H #include #include #include #include class C1{ private: std::map> cmap; …
Rich
  • 71
  • 8
1
vote
4 answers

Use of protected specifier in a derived class

I am unsure of the correct access specifier for the member var isMouseOverYard. In the snippet I don't have plans to inherit from House. Option 1 is more consistent with the base class (if I were to inherit from either class I can check whether the…
user870130
  • 565
  • 1
  • 8
  • 16
1
vote
1 answer

Catch the PHP private __constructor fatal error and throw an exception PHP?

I would like to ask if this is possible: I have a class with a private constructor which of course throws a fatal error if I try to instantiate that class from an invalid context (outside the class), can I catch this fatal error and the name of the…
tonix
  • 6,671
  • 13
  • 75
  • 136
1
vote
1 answer

Not able to switch my Docker's automatic build repository to a private repository for an Organisation

when I try to switch my automatic build repository to a private one, I got a message telling me that I must upgrade my plan. I'm a-on a free plan (only 1 private repository). The fact is I had a previous repository in the private section and I…