Questions tagged [private-methods]
285 questions
-1
votes
1 answer
Change the behavior of a function in closure
I have to upgrade a small private function in a 1500 LoC JS module, written in The Revealing Module Pattern.
Simplified task looks like this:
var module = module || function (){
function init(){
// you can upgrade init anyhow to be able…

Dmytro Gierman
- 335
- 3
- 8
-1
votes
1 answer
Should private function members be exception safe?
When writing exception-safe code, should all private member functions guarantee at least basic exception safety? What would be best/good practice in this situation? Alternatives?
For example, say I have a class Foo with public function member…

Jasper Braun
- 109
- 8
-1
votes
1 answer
How does placing a public method's implementation in a private method prevent disrupting consumers?
This question stems from several related questions, and is somewhat reasking the first which doesn't seem to have a clear answer to the OP's main question:
Private Methods Over Public Methods
Why hide a class…

Dewick47
- 171
- 11
-1
votes
1 answer
Accessing variables from prototype-defined functions
Lets say I have this function, I am trying to get values of value1 and 2 , what’s the right way to do it.
1. how do I make value 1 and value 2 defined , when it exits the function
2. how do i get the value in another function without calling…

makusa
- 1
-1
votes
1 answer
Which technique to use for creating private methods in Obj-C?
When I want to create private methods in Objective-C, what should I use?
1) The well known categories technique.
2) @private directive.
(I'm doing iOS development).

Chiron
- 20,081
- 17
- 81
- 133
-1
votes
2 answers
simple constructor generates errors
I get a lot of errors over what should be a simple constructor for a fighter class. Furthermore, they seem to be illegal start of expression errors or ; expected errors, for the most part.
This is my code:
class Fighter(String name, int health, int…

Gary Theurpe
- 63
- 1
- 5
-1
votes
2 answers
Overriding private methods and visibility
I know that private methods are hidden in Derived class and they cant be overridden but my question is different.. Please go through the following problem. My question is mentioned in the problem stated below:
TestPolymorphism.java
class…

priyank
- 11
- 1
- 5
-1
votes
1 answer
Private method `import' called for #?
Does anyone know about this stuff, I'm getting frustrated by it.
DEPRECATION WARNING: Calling set_table_name is deprecated. Please use `self.table_name = 'the_name'` instead.(called from at /**/config/environment.rb:12)
== …

agstwn21
- 123
- 1
- 14
-1
votes
1 answer
Java Program to make Tic Tac Toe not working
For my programming class I'm supposed to make a program that simulates a game of tic tac toe. My teacher provided all the methods and said we shouldn't need to add any or take any away, and told us we shouldn't change the playGame method, but no…

ameliafromafairytale
- 45
- 1
- 6
-2
votes
1 answer
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 elements equal to -1.
if (statValue.length == 6)…

Ozakriid
- 7
- 3
-2
votes
1 answer
Using unexported functions/types from stdlib in Go
Disclaimer: yes I know that this is not "supposed to be done" and "use interface composition and delegation" and "the authors of the language know better". However, I am confronted with a choice of either copy-pasting from the standard library and…

Julik
- 7,676
- 2
- 34
- 48
-2
votes
1 answer
Call a Non-Static Method in Another Project and Namespace
I have two Windows forms applications that belong to separate solutions. I'm trying to call a method from one using the other. I created a class library from the solution I'm trying to access (Sol1) and referenced it in the project I'm running…

AxxieD
- 614
- 1
- 7
- 28
-2
votes
2 answers
No overload for method '(method)' takes 1 argument
I have this quote, and it keeps showing me error:
no overload for method `getDistinctRegister5' takes 1 argument.
private int getDistinctRegister5(string module, string sij)
{
string dateFrom = TbDateFrom.Text.Trim();
string…

Claudia Peh
- 27
- 2
- 4
-2
votes
3 answers
Java public variable is zero in private class
This is my second day with java, and I can't figure out why public variable is 0 within private method. Code is as follows:
public class SomeClass {
public int[][] gridArray;
private int N;
public methodOne(int N){
gridArray…

Fortyq
- 11
- 1
- 7
-4
votes
1 answer
How do i Declare methods in public and write the code in private
I have been given this code with the restraints that i can not edit the public in anyway and am not allowed to call any other library's other than the ones specified.
Class example
{
private:
vector vector_1;
void function_1(string name)
…

herbeir
- 1
- 1