Probleme de pointers et de visual .net
Bonjour,
Actuellement je travaille sur un projet de labyrinthe en 3D pour mon universite en Irlande (oui les projets sont sympas), mais helas j'ai quelques petits problemes avec le code suivant sous visual .net :
Code :
Code:
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 39 40 41
| Maze::Maze (Maze& m)
//Description: constructor by copy
//if m is the same object as the object construct so
//the object is construct qith a size of 0 and a NULL pointer
//Arguments:
// m: maze to copy
//Return: none
//Contract: none
{
if (&m != this)
{
this.width = m.getWidth() ;
this.height = m.getHeight() ;
this.nbLayer = m.getNbLayers() ;
//copy of the structure
this.mazeStructure = new int **[m.getNbLayers()] ;
for (int i = 0; i < m.getNbLayers(); i++)
{
mazeStructure[i] = new int *[m.getHeight()] ;
}
for (int i = 0; i < m.getNbLayers(); i++)
{
for (int j = 0; j < m.getHeight(); j++)
{
mazeStructure[i][j] = new int [m.getWidth()] ;
}
}
//copy of the data
}
else
{
width = 0 ;
height = 0 ;
nbLayer = 0 ;
mazeStructure = NULL ;
}
} |
en sachant que mazeStructure est : int *** mazeStructure ;
Et les erreurs sont les suivantes :
f:\Maze\Maze\Maze\Maze.cpp(90): error C2228: left of '.width' must have class/struct/union type
f:\Maze\Maze\Maze\Maze.cpp(91): error C2228: left of '.height' must have class/struct/union type
type is 'Maze *const '
did you intend to use '->' instead?
f:\Maze\Maze\Maze\Maze.cpp(92): error C2228: left of '.nbLayer' must have class/struct/union type
type is 'Maze *const '
did you intend to use '->' instead?
f:\Maze\Maze\Maze\Maze.cpp(95): error C2228: left of '.mazeStructure' must have class/struct/union type
type is 'Maze *const '
did you intend to use '->' instead?
Est ce que quelqu'un a une suggestion a me faire ? :?
Merci beaucoup
Xavier