ESPN,
Due to Encapsulation I would put the constants specific to a class in that
class, if a constant was shared between classes, then I consider putting
them in a base class. If the "constants" happen to be integers, I would
consider creating an Enum for related constants...
Is LAUNCH_TEXT the same for each class, or does it vary?
If LAUNCH_TEXT varies then I would consider a polymorphic constant function
(or readonly property).
The base class would declare LAUNCH_TEXT as an abstract function or readonly
property, each derived class would implement the function or property
returning a literal.
The base class could then use LAUNCH_TEXT much like a constant.
If LAUNCH_TEXT is the same, then I would use a base class or a "static"
class that groups related constants...
Hope this helps
Jay
"ESPN Lover" <es**@lover.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
I'm fairly new to the whole .NET and OOP programming so bear with me.
In the past if I wanted to have constants defined that I could use in my
code, I'd include them either the file or as an include file. But with
.NET
and OOP, there has to be a different way than just including them in each
of
the classes I want to utilize them in.
Here's an example of what's in the definition of each of the classes I
need
to use it in.
private const string LAUNCH_TEXT = "Welcome to the Program";
private const string QUIT_TEXT = "Goodbye";
Can this be put into it's own file and then "included" with each class I
want to use it in? What would be the proper way? Thanks!