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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:34:07+00:00 2026-05-26T04:34:07+00:00

In my program I have classes for Vertex’s Edges and Faces which I’ll hopefully

  • 0

In my program I have classes for Vertex’s Edges and Faces which I’ll hopefully use to model shapes. Previous to this my Edge class included my “vertex.h” file and my Face class included my Edge.h file. In the Face class I declared some edge type variables and in the Edge class I declared some variables of type vertex. All working. My problem is during my implementation I realized I want edges to be aware of the faces they are joining together and I wanted to store this within edge. I wanted to declare a pointer of type Face and in the constructor to the class use:

Face * joiningFaces = new joiningFaces[2];

When I do this I get syntax errors that say that Face isn’t a type, even once I include Face.h in Edge.h includes.

Is there some sort of hierarchy system which prevents me from including Edge in Face as well as Face in Edge? or am I doing something stupid?

===Code====

===edge.h===

#ifndef EDGE_H_
#define EDGE_H_
#include "Vertex.h"
#include "Face.h"



class Edge {

private:
    Vertex a;
    Vertex b;
    Face * joinsFace;

public:
    Edge();
    Edge(Vertex newa, Vertex newb);
...ect
};

===Face.h===

#ifndef FACE_H_
#define FACE_H_
#include "Edge.h"
class Face {


private:
    Edge a;
    Edge b;
    Edge c;

public:
    Face();
    Face(Edge newA, Edge newB, Edge newC);
    virtual ~Face();
    Edge getEdgeA();
    Edge getEdgeB();
    Edge getEdgeC();
};

#endif /* FACE_H_ */
  • 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-26T04:34:08+00:00Added an answer on May 26, 2026 at 4:34 am

    You have a circular reference; if you only need to refer to pointers or references to Face in Edge.h, then you can forward-declare Face instead of including Face.h:

    class Face;
    

    Think about how inclusion works: if you were to paste the contents of Face.h in Edge.h, and then the contents of Edge.h in Face.h, you would have an infinite loop; include guards prevent multiple inclusion:

    #ifndef X_H
    #define X_H
    
    // ...
    
    #endif
    

    But if you have classes that refer to one another, you must forward-declare one or both of them in order to break the cycle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a program that has 3 classes of which 2
In my program I have two classes: Collector and Entity. Collector stores Entities in
I have a program with two TForm classes and have added a TMainMenu to
I've got a program where a lot of classes have really complicated configuration requirements.
I have a strange Hibernate behaviour in my program. I have two classes with
I want to program something in both C# and F#. I have partial classes
I have a Java program that generates Java classes for my application. Basically it
I have a Java program that loads thirdparty class files (classes I did not
I have three classes in my C# program. Get the following error: Cannot implicitly
I have two classes, a Teacher class and a Student class. In my program

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.