Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1017443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:42:21+00:00 2026-05-16T10:42:21+00:00

Rookie C++ Programmer here again I’m using VC++ VS2008 and making an attempt at

  • 0

Rookie C++ Programmer here again

I’m using VC++ VS2008 and making an attempt at creating an array of arrays. All objects I wish to store I want to put on the heap.

In the arrays it’s all just pointers.

Here’s some code:

Grid.h

#include "Tile.h"

class Grid
{
public: 
    Tile* grid_ptr[8][8];
...
...
};

Grid.cpp

#include "stdafx.h"
#include "Grid.h"

...
...
void Grid::Initialize()
{
    for(int i = 0; i < 8; i++)
    {
        Grid::grid_ptr[i][0] = new Tile::Tile(10,10);
        for (int j = 0; j < 8; j++)
        {
            Grid::grid_ptr[i][j] = new Tile::Tile(10,10);
        }

    }
}
...
...
}

Everything works just fine including the tile construction. It seems like a syntax error seeing as the compiler gives me this

Error 1 error C2061: syntax error : identifier ‘{ctor}’

Error 2 error C2061: syntax error : identifier ‘{ctor}’

All the time the same story. This has my entire work bogged down to a halt unfortunatly and I would MUCH Appreciate a solution to this.

In short. How do I properly create an array of arrays 8×8 in size filled with pointers referencing their respective tile objects ?

Is this even possible or smart to do using memory like that?

mind that I did read lots of examples on this, and doing so with integers or other datatypes has been a succes. That however simply isn’t want I want allocated

Tile.h here and Tile.cpp below

class Tile
{       
public:

private:
    enum TileOccupation
    {
        EmptyTile = 0,
        WhiteSphere = 1,
        BlackSphere = 2
    };

    unsigned short horizontalDimensions;
    unsigned short verticalDimensions;

public:
    Tile();
    Tile(unsigned short horizontalDimensions, unsigned short verticalDimensions);
    ~Tile();

void Update();
void Draw();


};

> Tile.cpp

#include "stdafx.h"
#include "Tile.h"

Tile::Tile()
{

}

Tile::Tile(unsigned short horizontalDimensions, unsigned short verticalDimensions)
{

}

void Tile::Update()
{

}

void Tile::Draw()
{

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:42:21+00:00Added an answer on May 16, 2026 at 10:42 am

    You don’t want to create a Tile::Tile (a constructor), you want to create a Tile (an object) – change new Tile::Tile to new Tile.

    Besides there is a leak. Remove this:

    Grid::grid_ptr[i][0] = new Tile::Tile(10,10);
    

    // EDIT

    Probably you were confused with dynamic arrays (the one we use when dimensions are unknown). Your array is static (booth dimensions) and you don’t have to dynamically allocate memory for it. It is part of your class and is created automatically with an object, the same way like e.g. simple int field.

    And one more. Consider if you really have to create tiles dynamically. Will you move tiles in and out of the array? Is the Tile bigger then few int`s? If the answer is “no” for any question then static allocation will be fine for you:

    Tile grid_ptr[8][8];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

rookie C++ programmer here still. I'm using VC++ VS2008 compiler and glut library. All
rookie here. i am using basic javascript, css to open/close div by clicking/unclicking on
all. Relative rookie here who has spent the better part of three days just
I'm pretty much the rookiest rookie when it comes to Flash. Here's the actionscript
Probably really a rookie question here about xcode (for the iphone).. When I issue
This should be really simple but I'm a javascript/jQuery rookie, so here we go:
I am a fairly rookie programmer who is trying to learn the basics of
I am programmer rookie, and I have to create outlook 2007 add-in. I should
I am a rookie in writing SQL stored procedure using C#. Just wandering is
Back again with another rookie question. While working on a function for my homework

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.