archana wrote:
I have created one sealed class having one constant.
Can i access that constant of sealed class without creating object of
that class. If yes will internally new object gets created. Or will it
behave like static member which remains in memory throughotut
applications' lifetime.
If the constant is public, then you can use it from other classes.
Referring to a constant *looks like* referring to a static field, but
the compiled code is different. Referring to a static field reads the
current field value from memory; every reference compiles to object
code that contains a memory address. (If the field changes, the value
you read changes.) Referring to a constant inlines the constant value
in the object code; it's just like using a literal value in your code.
Iow, referring to a constant will not create an instance of the class
(whether sealed or not) and will not allocate storage in the same way
that referring to a static field will.
--
..NET 2.0 for Delphi Programmers
www.midnightbeach.com/.net