Questions tagged [private-methods]
The private-methods tag has no usage guidance.
private-methods
285
questions
0
votes
1
answer
121
views
Calling private json file on Twilio serverless
I've upload 2 json file under Assets (as private) on Twilio serverless, I know that I need a function to let the code access this file, but it seams not working my code:
exports.handler = async ...
1
vote
0
answers
69
views
JS: Unexpected error message appear when private method is not accessible after "this unbinding"
When I intentionally make "this" of a method as undefined using a high order function and try to access the private method in the function(presented below as 'deprivedMethod2'), the error ...
0
votes
0
answers
55
views
How to test lambda expression included private method using Mockito?
I want to test this code.
public void send(String topic, Object value) {
Optional.ofNullable(observer.get(topic)).ifPresent(handler::removeCallbacks);
observer.put(topic, () -> send(...
0
votes
2
answers
69
views
Are private base class constructors still called?
#include <iostream>
// first base class
class Vehicle
{
public:
Vehicle() { std::cout << "This is a Vehicle\n"; }
};
// second base class
class FourWheeler
{
public:
...
0
votes
0
answers
140
views
Define private class *methods* with Google Apps Script
I want to create a class that has private methods. For example:
class RabbitDefiner {
#define(){
return "a rodent";
}
}
I get:
Syntax error: ParseError: Unexpected token ILLEGAL
...
0
votes
0
answers
31
views
How to write testng testcase for private final anonymous class
private final SampleFormatter sampleFormatter = new SampleFormatter() {
@Override
public String formatDouble (int tag, double Value, int pre) {
if (Double.isNaN(Value)) {
...
-1
votes
1
answer
76
views
trying to avoid violating encapsulation
starting some new stuff in Java and im kind of having a hard time. I feel like im on the right track just for some reason cannot find a way around the problem I am having without violating ...
0
votes
1
answer
48
views
Using a private field (#) as the typeof for an element
Check this code
interface PriceFormatOptions {
unit: string;
}
export default class PriceHelper {
/**
* Adds unit and separates thousands
*/
static format(
price: Parameters<...
0
votes
1
answer
188
views
Base class has inacessible destructor
The following code tries to define a self-similar datastructure JSON using the std containers std::vector and std::unordered_map but does not compile. It all seems to come down to std::unordered_map's ...
0
votes
1
answer
406
views
How to hide private functions from the user in bash?
After sourcing the following code my terminal is able to see __hey function.
super_tools() {
case "$1" in
"hey")
__hey
;;
*)
...
5
votes
1
answer
1k
views
Why is JavaScript private method accessible from console.log
I wrote a simple code:
const secure = new class {
#privateProperty = 4;
#privateMethod() {
console.log( 'The property ' + this.#privateProperty + ' should not be accessible outside ...
-2
votes
1
answer
54
views
Variable in for loop is giving a message that "The value of the local variable i is not used"
I wrote a for loop that is supposed to determine if there is user input. If there is, it sets the 6 elements of int[] valueArr to the input, a vararg int[] statValue. If there is no input, it sets all ...
0
votes
0
answers
26
views
Python: calling a private method within static method [duplicate]
What is the correct way and best practice to call a private method from within a static method in python 3.x? See example below:
class Class_A:
def __init__(self, some_attribute):
self....
0
votes
1
answer
388
views
Can't access the class variables from a event handler
I am making a web application for arranging seats, and I have written these codes:
class SeatMap {
constructor (parentElement) {
this.#createSeats();
}
#createSeats () {
...
0
votes
0
answers
102
views
How to access dundle method from a subclass in Python?
I there a way to directly access dundle method in sub-class of Python ?
Imagine I have the following classes :
class Parent(object):
def __init__(self, x):
self.x = x
def __add(...