473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

public const not public ?

Hi

public const char ETX='\u0003';

Does not seem to be public...

Why ?

If i remove the const keyword ,it then seems to work

Johan




Nov 16 '05 #1
3 1349
I think constants are static, meaning they must be referenced from the
class, not an instance of the class.

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:#T**************@TK2MSFTNGP11.phx.gbl...
Hi

public const char ETX='\u0003';

Does not seem to be public...

Why ?

If i remove the const keyword ,it then seems to work

Johan



Nov 16 '05 #2
Sagaert Johan wrote:
Hi

public const char ETX='\u0003';

Does not seem to be public...

Why ?

If i remove the const keyword ,it then seems to work


Since it's declared as 'const', it's also considered static (
http://msdn.microsoft.com/library/en...asp?frame=true
-- see first point under 'Remarks' ); so you'll have to say
'ClassName.ETX' instead of 'instanceName.ETX'.
Nov 16 '05 #3
Sagaert Johan wrote:

Hi

public const char ETX='\u0003';

Does not seem to be public...

Why ?

If i remove the const keyword ,it then seems to work

Johan


Look into readonly.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
10
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this...
21
by: jimmy | last post by:
Hi, I would like to initialize a member array of 3 floats with a memcpy (for reasons of efficiency). Later I would like to access the floats via public members (e.g. foo.x, foo.y, foo.z). Is...
1
by: Erik Tamminga | last post by:
Hi, I'm totally bluffed: how can a 'public const string name = "myname";' ever evaluate to null? I have the following class: public class MIB2 { public const string org = "1.3";
2
by: fgh.vbn.rty | last post by:
Hi, I'm not sure if i'm asking the question correctly but anyway here it is. Say I have 3 classes - class A, class B, class R. 1) A and B are the building blocks and R is like a repository...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.