Questions tagged [public]

`public` is an access-specifier in object-oriented languages; it indicates that all objects have access to the `public` field or method.

In object-oriented languages, classes specify how much access other classes can have to their members.

When a member has the public specifier, other classes have full access to that member.

Other access specifiers are protected and private.

You can use this tag for questions about how the public specifier controls (or fails to control) access to the members of a class, and questions on how it interacts with the other access specifiers.

1633 questions
0
votes
1 answer

How to fix Error "A conflict exists with definition * in namespace public." using ASC2.0?

In a class hierarchy where: MngLayers extends Manager_Panel, which extends Manager_Base... -- In Manager_Base, I've defined an init() method: public class Manager_Base { //.... public function init():void { //Do initialization…
0
votes
3 answers

PHP: Best practice regarding "public" visibility in OOP

Do you always add public beside methods and properties inside your classes? Or do you leave it out? 1. Option 1, without public:
MrZiggyStardust
  • 713
  • 6
  • 19
0
votes
2 answers

C# Access Of Public Method Between Forms

I'm trying to do a simple project for my module. I made a login system for my program and the idea is the menustrip controls are disabled until the user puts in the correct details and submits it. So far this is what I came up with and is in the…
aztec
  • 3
  • 1
0
votes
0 answers

MySQL set server to run not externally for internet

I know, that if I want I could run my application ( C++ or .NET ) , which I've developed internally. I mean, I have an external IP for my PC, but for the security reasons I don't want my application to be seen, so for it, I just set NOT an external…
Secret
  • 2,627
  • 7
  • 32
  • 46
0
votes
2 answers

How would I call this method to clear database at the start of my App?

This Method is in my database class public boolean deletePlayers(long paramLong) { return this.mDb.delete("Players", "_id=" + paramLong, null) > 0; } I want to call it in my Launch Activity class public class LaunchActivity extends…
b0w3rb0w3r
  • 927
  • 3
  • 11
  • 33
0
votes
1 answer

VB.NET Add row data to public class / public field of type List(Of T) Object reference not set to an instance of an object

I am trying to add rows to a public class that has public fields and am getting an error: Object reference not set to an instance of an object Public Class EmailRecipient EmailAddress As String = "" FullName As String = "" …
Charlez
  • 871
  • 3
  • 11
  • 17
0
votes
2 answers

Do I have to declare a class public (it's the only class in a program nobody will ever use)

I'm a beginning computer science student going through the Java gauntlet. We had to write a program with an error in it; it was a fun exercise actually. One of my classmates emailed me a patch(in English not diff) and said that he add public to the…
noel
  • 2,257
  • 3
  • 24
  • 39
0
votes
2 answers

Dictionary Inconsistent Accesability

I get an error in the code below on the first mention of the word tables. I need that dictionary to be usable by all classes. the error reads: Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.Dictionary' is less…
jth41
  • 3,808
  • 9
  • 59
  • 109
0
votes
1 answer

Java is not picking up keypresses?

I have a program which produces a JFrame and then a JPanel on top of it. For the program, I have tried implementing the KeyListener and then adding the methods (for both components), but the program does not pick any of my key strokes up. What am I…
user1546859
  • 240
  • 2
  • 10
0
votes
2 answers

why is my public variable returning old data?

I've got a simple .net app with one main window. There's some radio buttons on there that I want to check before processing the data. I have two sets of CS files. Form1.cs (The main window code) and the database.CS (The code that actually runs…
EtanSivad
  • 487
  • 8
  • 16
0
votes
0 answers

Value of local variable unused error

I am making a button that will take you to another page. I've done one button and it worked perfectly. But when I try another I get an error that stops it working. Button bWebs = (Button) findViewById(R.id.Webs); bUtuube.setOnClickListener(new…
user2154615
  • 13
  • 1
  • 2
0
votes
3 answers

public variables using in the second form

I have a "simple" problem with assign variables from FORM1 (in my code Form1) and using those variables in FORM2 (in my code frLeczenie). So I started to create a public string variables: public string wynikImie; public string…
Foee
  • 77
  • 1
  • 5
0
votes
1 answer

set() is deprecated since version 2.1 Access the public property 'vars' instead

I have been looking for other users with this symfony 2.1.8 to 2.2.0 upgrade depreciation warning: set() is deprecated since version 2.1 Access the public property 'vars' instead I have not been able to find anything in the official documentation,…
Andrew Atkinson
  • 4,103
  • 5
  • 44
  • 48
0
votes
4 answers

How to force use of a setter method without using private ? (public for read, private for write)

I have a Circle class type of object for which I have a member 'r' to store the radius. Now because I use these objects a lot, I don't want to make the radius private because other classes would to have to use a getR() method and it would make the…
jdbertron
  • 733
  • 7
  • 11
0
votes
4 answers

ruby on rails defining variables

I've been trying to do this for a few hours now. I'm pretty new to Ruby and Rails. In a devise.html.erb file I have
<%= render :partial => 'layouts/header' if user_signed_in? %>
The above works fine. If the user has…
CHarris
  • 2,693
  • 8
  • 45
  • 71