Avatar of jl66
jl66
Flag for United States of America asked on

Is there any way to make a global constant in C++ classes?

Have 2 C++ classes:
class c1;
class c2;

Would like to define a global constant g_const in c1 but the global constant value obtained with a method M1 in c1. It will be used in c2. How to do that or it can't be done.

C++C

Avatar of undefined
Last Comment
jl66

8/22/2022 - Mon
jl66

ASKER
This global constant can be string or number.
ASKER CERTIFIED SOLUTION
Minh Võ Công

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Minh Võ Công

SOLUTION
evilrix

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
sarabande

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
jl66

ASKER
Thanks for everyone.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23