int tab[] = { 1, 2, 3, 4, 5 ,6, 7, 8, 9, 10};
12345678
class table { int tab[] = { 1, 2, 3, 4, 5 ,6, 7, 8, 9, 10}; public: func1(); func2(); func3(); };
12345
public: func(); func2(); private: float tab[] = { (float)0.5, 1,(float)1.5, 2, (float)2.5, 3 };
error C2059: syntax error : '{' error C2334: unexpected token(s) preceding '{'; skipping apparent function body
12345678910111213141516171819202122232425
#include <iostream> class Foo { public: Foo() {} void Func0() { std::cout << "table[0] = " << table[0] << std::endl; } void Func1() { std::cout << "table[1] = " << table[1] << std::endl; } void Func2() { std::cout << "table[2] = " << table[2] << std::endl; } void Func3() { std::cout << "table[3] = " << table[3] << std::endl; } private: static const float table []; }; const float Foo::table[] = { 0.25f, 0.4f, 0.023f, 1.24f }; int main() { Foo f; f.Func0(); std::cout << "Press enter to exit..."; std::cin.get(); return 0; }
error LNK2001: unresolved external symbol