0

If I declare variable in class as const, and create multiple instances of this class, variable will be copied for each instance or not?

1
  • If something is constant, it is perfectly safe and reasonable to share it, which is exactly what happens. Commented Feb 18, 2015 at 20:59

1 Answer 1

2

No. const fields are implicitly static.

Sign up to request clarification or add additional context in comments.

2 Comments

Are they static or "implicitly like static"?
Implicitly static, meaning that the compiler makes these variables static behind the curtain. See Jon Skeet's answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.