Questions tagged [public-method]

A public method is a method declaration that allows access from other classes external to the current class.

A public method is a method declaration that allows access from other classes external to the current class. Public methods are used in many Object-Oriented programming languages including Java, C#, and Objective-C

From http://www.javabeginner.com/learn-java/introduction-to-java-access-modifiers

Fields, methods and constructors declared public (least restrictive) within a public class are visible to any class in the Java program, whether these classes are in the same package or in another package.

184 questions
2
votes
4 answers

Access Of Public Method Between Forms

I am trying to get access to Form1’s public method on another form Form2 as below. I have a textbox6 control on form1 and there is public method to bind it. But I want to bind it by form2 as below. Form1 public partial class Form1 : Form { …
mahesh
  • 1,370
  • 9
  • 36
  • 61
2
votes
1 answer

How to verify number of call of private method in public method in Junit?

public void publicMethod() { for (i=1;i<10;i++) privateMethod(); } private privateMethod() { something... } I need to write a JUnit testcase to verify the number of times the privateMethod() is called.
Avi
  • 29
  • 2
2
votes
3 answers

Make a public type face method in Android

I am trying to apply a custom font in different Activities, right now I have the following code in the onCreate() in my MainActivity: String fontTitle = "fonts/OpenSans-Bold.ttf"; Typeface titleFont = Typeface.createFromAsset(getAssets(),…
Rain Man
  • 1,163
  • 2
  • 16
  • 49
2
votes
1 answer

java inner class private constructor, public members

I'd like to know if this is the preferred way to design a class; if not what's wrong with it and what's a better option? class Calculator { public Calculator(Input input) {...}; CalculatorOutput output; class CalculatorOutput { private…
labheshr
  • 2,858
  • 5
  • 23
  • 34
2
votes
1 answer

Why only public methods are allowed in an interface?

Why does java force interface methods to be public and how does abstract class differs from an interface?
user6173455
2
votes
3 answers

public variables in php

I have this function: function map(){ $address = mashhad; // Google HQ $prepAddr = str_replace(' ','+',$address); …
amin gholami
  • 453
  • 3
  • 10
2
votes
6 answers

Why are these methods public?

My javascript looks like the following. I don't understand why these methods are all public though? Something.RegisterNamespace("One.ABC"); (function(ABC) { ABC.SayHello = function() { alert('hello'); }; …
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
2
votes
5 answers

Action -methods vs public methods in PHP frameworks

There are plenty of PHP frameworks out there as many of you know, and I am interested in your thoughts on this: Zend Framework has so-called action controllers that must contain at least one action method, a method whose name ends in "Action". For…
Tower
  • 98,741
  • 129
  • 357
  • 507
2
votes
1 answer

How to differentiate public methods and private methods during api testing?

Is it possible to test private methods of a web service, during api testing? If yes, how to differentiate public methods and private methods? I am using the object browser in VSTS to see the list of methods available.
Anil
  • 665
  • 1
  • 10
  • 14
2
votes
0 answers

Document exceptions thrown by methods called by a public method

Do I, or do I not, document exceptions thrown by methods begin called by a public method? Based on what I've read, I should try to document such exceptions, which makes sense. At the same time, it can quickly turn out to be "impossible" to document…
user1323245
  • 638
  • 1
  • 8
  • 20
2
votes
1 answer

Getting "public variable" in a "private method" using CoffeeScript

I have the following code: class Example @text = 'Hello world! ;)' getText = -> @text constructor: -> alert(getText()) ### Instance ### example = new Example This will return 'undefined', Is there any way to make it return the…
Caio Tarifa
  • 5,973
  • 11
  • 46
  • 73
2
votes
4 answers

Python: Public methods calling their 'brother' private methods

I have been writing Python code for only a couple of weeks, so I'm still figuring out the lay of the land. But let's say I have a method that MAY be called on by a 'user' on occasion as well as used HEAVILY internally (ie, the arguments have already…
TallPaul
  • 1,001
  • 4
  • 10
  • 12
2
votes
2 answers

videojs public method access outside ready function and IE

I built a player on top of videoJS and I'm having trouble accessing public functions inside videoJS .ready(). The thing is that my code appears to be working everywhere except IE (works in chrome, safari, ff, etc.): var myPlayer =…
1
vote
1 answer

Getting all public variables and methods in SWIG

If my C++ class has been wrapped by SWIG and exposed to the python interpreter. Is there a way to retrieve a collection of all public variables and methods in python? Thanks!
delita
  • 1,571
  • 1
  • 19
  • 25
1
vote
4 answers

How to create public method?

This is a newbie type question. I want to create a public method that can be accessed by any activity in the application. The method I am trying to create is a simple method to show the versionName or VersionCode. here is the code I use in a private…
benbeel
  • 1,532
  • 4
  • 24
  • 38