You got the syntax right, but if arr_
is an immediate member of the class (and it probably is), then you simply can't return a non-cost reference to this member. Inside the above arr
method, member arr_
is seen as having const Chips[6][7]
type. You can't use this type to initialize a reference of Chops (&)[6][7]
type since it would break const-correctness. In order for the above to compile you'd need a const
on the returned reference as well
...
const Chips (&arr() const)[6][7] { return arr_; }
...
But in any case, you'll be much better off with a typedef
...
typedef Chips Chips67[6][7];
const Chips67 &arr() const { return arr_; }
...