Инициализатор элементов данных C++ не разрешен

Я совершенно новичок в C++, так что потерпите со мной. Я хочу сделать класс со статическим массивом, и доступ к этому массиву из main. Вот что я хочу сделать в C#.

   namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Class a = new Class();
                Console.WriteLine(a.arr[1]);

            }
        }
    }

    =====================

    namespace ConsoleApplication1
    {
        class Class
        {       
            public static string[] s_strHands = new string[]{"one","two","three"};
        }
    }

Вот что я попробовал:

// justfoolin.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;

class Class {

  public:
      static string arr[3] = {"one", "two", "three"};
};


int _tmain(int argc, _TCHAR* argv[])
{
    Class x;
    cout << x.arr[2] << endl;
    return 0;
}

Но я получил: IntelliSense: инициализатор элементов данных не допускается

10
задан user1435915 7 June 2012 в 16:33
поделиться