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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:11:11+00:00 2026-06-15T21:11:11+00:00

I have a custom shape class, simplified for the question here, and looks like

  • 0

I have a custom shape class, simplified for the question here, and looks like the following:

class Shape : public SpriteProperties{

};

where class SpriteProperties is:

class SpriteProperties{
Point rotationPivotPoint;
Point rotationPivtoAxes;
float width, height, xPos, yPos, zPos;
Point color;
};

In the user’s code, when the user initializes the shape, he uses a function of the following prototype. The params in the function are the required properties for any shape to be represented.

void init(float _x, float _y, float _w, float _h, Point* _color)
{
    //Initialize the shape
}

However, my shapes also have additional properties such as rotation pivot points and axes, that the user should specify during this initialization process somehow, and these rotation properties might/might not come to use at a later point for the user depending on how he used the class.

void prepareRotationParams(Point* _rotationPivot, Point* _rotationAxes)
{
    //
}

My question:
I am thinking of restricting the user to use this prepare rotation function which might be utilized at a later point in the code, and at the same time I do not want to give the prepare rotation params in the init function itself, since these do not fall in line with the core properties that must be explicitly specified by the user for any shape. What would be the ideal approach?

  • 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-06-15T21:11:12+00:00Added an answer on June 15, 2026 at 9:11 pm

    Use default arguments:

    void init(float _x, float _y, float _w, float _h, Point* _color, Point* rPivot=0, Point *rAxes=0)
    {
        //Initialize the shape
        if (rPivot && rAxes) {
            prepareRotationParams(rPivot, rAxes);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom view with a layerClass override like: + (Class) layerClass {
I have a custom line shape with start and end point. The ActualWidth and
I have custom app class public class MyApp extends Application { public static Context
I have custom validation rule: public function customRule($check) { } Inside this rule I
Here's a simplified version of my needs. I have a program where every B
I have a large enum declared in my class public enum CarMaker{ Honda, Toyota,
I have a custom model class which contains a decimal member and a view
WPF, Shapes I have a custom Shape , and try to implement MouseClick and
I have a custom Shape - MyShape - (may be control, does not matter).
I have an array myArr which contains objects of custom class..e.g. objs of type

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.