How to create a class of all constant values

Hi everyone,

I am dealing with a chemical engineering code.
At this stage, I'd like to create a class with several functions containing the properties of the chemical components, say methane. So I have a class called parameters, and the member functions are methane, ethane, etc. I would like to insert all constant values in each component member function such as molar weight, density, and so on.
Within the entire program I will refer to any of parameters I need. For example if density variable is called rho, I will access density of methane by using:

parameters::methane.rho

I am new in C++ and still learning, I would certainly be very grateful that someone gives me a little piece of code how to deal with it.

Many thanks
1
2
3
4
5
6
7
8
9
struct molecule{
   double rho;
   //...
};

namespace parameters{
   const molecule methane = {/*values*/};
   //...
};


To add new molecules, you'll have to recompile the project.
Topic archived. No new replies allowed.