blob: ac94db8690c357178d2dacf70c8ee593dd8ea4a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <iostream>
#include <vector>
/*
*
* 7.58
*
*
*/
class Example {
public:
static double rate; // Cannot be initialized here
static const int vecSize = 20;
static std::vector<double> vec; // Cannot be initialized here
};
// We initialize them here instead
double Example::rate = 20;
std::vector<double> Example::vec(vecSize);
int main () {
/*
// example.h
class Example {
public:
static double rate = 6.5;
static const int vecSize = 20;
static vector<double> vec(vecSize);
};
// example.C
#include "example.h"
double Example::rate;
vector<double> Example::vec;
*/
return 0;
}
|