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 4100220
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:32:18+00:00 2026-05-20T20:32:18+00:00

So I made my own class in order to hold a 3D vertex. That

  • 0

So I made my own class in order to hold a 3D vertex. That basically looks like:

class Vertex                                    // Vertex Class
{
public:
    float x;                                // X Component
    float y;                                // Y Component
    float z;                                // Z Component

    float getX() {
        return x;
    }
    float getY() {
        return y;
    }
    float getZ() {
        return z;
    }
};

Now I need to make a 2D array of these but when I initialize it it won’t work. Basically each row will be a face of a polygon. And each column will contain a vertex of that row. So if one row is

(0,0,0) (1, 1, 1) (3, 3, 3) (4,4,4);

Then that row will represent a face with vertices (0,0,0) (1, 1, 1) (3, 3, 3) (4,4,4);

Now when I try to initialize it using

Vertex faces = new Vertex[num_faces][4];

It work work. This seems pretty simple so what am I doing wrong?

EDIT: I changed it to

Vertex *faces = new Vertex[num_faces][4];

and I get this error:

cannot convert from ‘Vertex (*)[4]’ to ‘Vertex *’

  • 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-20T20:32:18+00:00Added an answer on May 20, 2026 at 8:32 pm
    cannot convert from 'Vertex (*)[4]' to 'Vertex *'
    

    The compiler is already telling you what you need to know, just change the type of faces:

    Vertex (*faces)[4] = new Vertex[num_faces][4];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ArrayList as an Object(from reflection) and made my own class that
I have made my own exception class which derives from runtime_error and is getting
I made my own class derived by NSObject, and here is my code: -(void)
I m developing a program that makes use of UIImagePicker custom class made by
I'm still learning about object oriented programming... I made my own simple button class
I'm pretty new to JQuery so I made my own light box that comes
I've made my own captcha class in PHP, just to learn. It's ok, working
I have a problem with classes. I made my own class called Person. Which
I have made a .NET class library in C# that initializes some logging, sent
I made my own class with touch events to move and zoom a picture

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.