Salve, è la prima volta ke metto dentro una classe una matrice e non so come bisogna dichiararla??
nel main avrei fatto come sotto.Ma compilando la classe come scritto in baxo mi escono i seguenti errori:
MazzoCarte.h:9: error: invalid use of non-static data member ‘MazzoCarte::N’
MazzoCarte.h:11: error: from this location
MazzoCarte.h:11: error: array bound is not an integer constant
MazzoCarte.h:10: error: invalid use of non-static data member ‘MazzoCarte::M’
MazzoCarte.h:11: error: from this location
MazzoCarte.h:11: error: array bound is not an integer constant
MazzoCarte.h:15: error: array bound is not an integer constant
MazzoCarte.h:15: error: array bound is not an integer constant
qualcuno mi sa dire dove sbaglio, cosa dovrei cambiare ?codice:class MazzoCarte { private: const int N; const int M; Carta mazzo[N][M]; public: MazzoCarte(const int N,const int M,Carta mazzo[N][M]); };![]()

Rispondi quotando