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

  • Home
  • SEARCH
  • 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 6156891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:41:26+00:00 2026-05-23T20:41:26+00:00

Hey I have an abstract class named Partition which is a functor, and its

  • 0

Hey I have an abstract class named Partition which is a functor, and its a member of my ConcavePolygon class. The Partition Functor depends on a lot of the ConcavePolygon’s data such as TPPLPoints and SFMLPoints.

  • I’ve found that even though i’ve defined the class inside the one it
    depends on, i can’t easily reach Concaves’s data. How do i do
    this?

  • I also want to use some functions from the Body class, and hoped to
    do that through ConcavePolygon since its a descendent from it. (needs
    the AddShape() function);

here’s the code if it’s helpful:

class ConcavePolygon : public Body{ 
protected:
    std::list<Vector2f> SFMLPoints;
    std::vector <TPPLPoint> TPPLPoints; //TODO: figure out how to make a temp version without Memory Exception

public:
//////////////////// Partitioning/Triangulating Classes /////////////////////////////////////////////////////////////
    class Partition{
    protected:
        virtual void RunAlgorithm(){};

    public:
        Partition(Vector2f* Points, long numbPoints){ //TODO turn this into a base class for triangulate or Convexulate

        //rev up all the needed data structs
        std::list<TPPLPoly> PartitionOutput;
        std::list <TPPLPoly> ::iterator I;

        //Backup the points, and convert them to tppl
        for(int I=0; I<numbPoints; I++){
            TPPLPoints.push_back(TPPLPoint(Points[I].x, Points[I].y));
            SFMLPoints.push_back(Points[I]);}
        TPPLPoly Poly(&TPPLPoints[0], numbPoints, false);

        //clear everything to be filled with the Partition Algorithm
        this->Clear();

        // Run the Partitioning Algorithm
        RunAlgorithm();

        // Convert results to SFML points, shapes, and add to the body
        for( I= PartitionOutput.begin(); I!= PartitionOutput.end();I++){
            sf::Shape TempShape;
            for(int i=0; i< I->GetNumPoints(); i++)
                TempShape.AddPoint( I->GetPoint(i).x, I->GetPoint(i).y);
            this->AddShape(TempShape);
        }
    };
};

    class Convexulate: public Partition{
        bool RunAlgorithm(TPPLPoly& Poly, std::list<TPPLPoly>& PartitionOutput){
            TPPLPartition Partition;
            Partition.ConvexPartition_OPT(&Poly, &PartitionOutput);
        };
    };

    class Triangulate: public Partition{
        bool RunAlgorithm(TPPLPoly& Poly, std::list<TPPLPoly>& PartitionOutput){
            TPPLPartition Partition;
            Partition.Triangulate_OPT(&Poly, &PartitionOutput);
        };
    };
//////////////////////////////////////////////////////////////////////////////////////////////////////


//////////////////////  Constructors    /////////////////////////////////////////////////////
    ConcavePolygon(Vector2f* Points, long numbPoints){
        Convexulate(Points, numbPoints);
    };


};// ConcavePolygon Class
  • 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-23T20:41:27+00:00Added an answer on May 23, 2026 at 8:41 pm

    In C++, nested classes are really just a way of scoping namespaces (and providing protection: public/protected/private) for class names. They do not create any special relationship between the two classes besides the name: OuterClass::NestedClass.

    So you need to treat nested classes like they are separate classes. If you want the NestedClass to get access to the private members of the OuterClass, you must explicitly declare it a friend of the OuterClass. If you want the NestedClass to access a particular instance of an OuterClass, you must give it an instance of the OuterClass.

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

Sidebar

Related Questions

Hey I have a node <msg> which contains a message such as string1 string
Hey i have this div that shows as a popup: <div class=popup> </div> Then
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class
Hey I have the following situation: a WinService which is processing some stuff from
Hey i have a iframe that i am sizing to its content with the
hey I have a small problem with my rake class CreateEvents < ActiveRecord::Migration def
Hey Folks,I have pasted my code here. Dialog.inform contains a 'long' value which is
Hey i have a situation in which i need to pass some variable value
Hey I have a problem with Simple DOM parser which is driving me nuts.
Possible Duplicate: Uninitialized constant ActiveSupport::Dependencies::Mutex (NameError) Hey I have seen this issue a lot

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.