Questions tagged [private-methods]

285 questions
0
votes
1 answer

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 ;; *) echo "Invalid argument: $1" ;; esac } function…
0
votes
0 answers

How we can mock successive calls of a private method being called from a public method of class being tested

Could not mock multiple return value for a private method of class under test, being called from public method of same class. I am using PowerMockito in java to mock multiple return values from a private method.
0
votes
0 answers

How to exclude Private Method from Coverage?

My code has a private method, say X. X is called/referenced only by one another public method Y. Y is excluded from coverage using the [ExcludeFromCoverage] attribute. And hence my private method X is not covered while running coverage tool. It is…
0
votes
3 answers

In ObjC, how do I hide implementation a superclass's methods in a subclass?

In ObjC, how do I hide implementation a superclass's methods in a subclass? I'm not sure if @private would do the trick, as it appears to only apply to ivars.
AWF4vk
  • 5,810
  • 3
  • 37
  • 70
0
votes
0 answers

Python: calling a private method within static method

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.some_attr = some_attribute def…
Mehdi RH
  • 322
  • 1
  • 7
  • 18
0
votes
1 answer

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 () { this.seatList = []; for (let a = 0; a <…
0
votes
0 answers

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(self,y): return self.x + y def…
FraSchelle
  • 249
  • 4
  • 10
0
votes
1 answer

Flutter private methods function

How to change it to private method? I dont know how @override void initState() { super.initState(); _initPackageInfo(); } Future _initPackageInfo() async { final info = await PackageInfo.fromPlatform(); setState(() { …
0
votes
0 answers

How do you access a private static method from a public static method of the same class?

My JavaScript method overloading implementation below can't access my private static method in line 10. It seems the # symbol cannot be embedded into a string. JavaScript Code 1 'use strict'; 2 3 class MyClass { 4 static myFunction() { 5 …
user18630166
0
votes
2 answers

Ruby: Can not read an attribute by self.attr

I am learning Ruby basic, and trying to do some tests. I encounter an issue to understand the class method accesss scope. Here is my code. class User attr_accessor :name def initialize(name) @name = name @login_status =…
douyaba
  • 9
  • 2
0
votes
1 answer

Uncalled private method in an interface

I have an interface with a default method and a private method, where the private method is called from the default method. When running Spotbugs, it issues an error that the private method is never called: UPM_UNCALLED_PRIVATE_METHOD. public…
Oboe
  • 2,643
  • 2
  • 9
  • 17
0
votes
1 answer

(NoMethodError) Undefined private method in model - Rails

I'm building a simple ecommerce webpage and the functionality I want to create is: User clicks an "ADD TO CART" button in one of the products --> the ORDER is created with the user_id --> the ORDER_ITEM is created with order_id and product_id. I…
josegp
  • 499
  • 6
  • 21
0
votes
1 answer

Obj C codebase and unit test cases in Swift

I have an objective c code base and I am writing snapshot test cases in swift. I have certain functions and variable which are declared in .m class. How I can access those variables from swift test class.
0
votes
1 answer

ES6 Private Methods with access to "this" keyword JavaScript idioms

I'm learning JavaScript and NodeJS as I go for a work project and have been making heavy use of ES6 classes over ProtoTypes. I would like to use private methods or something like private methods, but it seems like this is not a feature of JavaScript…
0
votes
1 answer

How can i get a Value of Variable from a private Method in C# Window Form Application

I'm trying to Get a Value From the variable I Diclear in a private Method and I want to use that value in another private method First I want to add a picture in the Picture box I create this Button after using FileDialog for browsing pictures I…