title: assigning constant value to struct members to be used in 1 class
body: <p>So far I've read about structs, with and without pointers. My question is about a struct in combination with a class and main. What I learn from K&amp;R and c++ sites is that a struct can't contain values. The values I want to assign to the members will be constants. In several posts I read that I should put the struct inside the class and even inside private. The setup I use was:</p>
  
  <pre><code>class C
  {
  struct something {const float m = 3} s;` //actually 12 members. Compiler doesn't accept  values: "ISO C++ forbids initialization of member"
  
  function foo(struct something s){ float m = s.m; &lt;..do something..&gt;}` //struct s actually used in several functions
  
  };    
  
  int main(){C c;}
  </code></pre>
  
  <p>Then I created 2 structs, and letting the 2nd assign values to the members of the first, which I find ugly. But why did that get accepted by gcc? So how can I assign the values only once in a proper way since assigning values has to be done inside a function. BTW, I'm using Ubuntu gcc-4.6.1.</p>
  
  <p>Thank you for an answer.</p>