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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:31:11+00:00 2026-05-21T07:31:11+00:00

I have problem with the declaration of enum in my class. I had tried

  • 0

I have problem with the declaration of enum in my class.
I had tried to declare it on private, public, outside, in the main, nothing works.
I need to call function in the class from outside and use the enums in the function
here is my code.

class Algoritem {
    public:
    enum Optimization { W , A , D };
    enum FenceType { OF , CC };
    enum Eventopa { BR , OR };
    algorithem* OptimalPatrol(double N, int K, double VS, double T, Optimization F,FenceType FT, Eventopa E, double Imax,double P);
};

When I need to call OptimalPatrol() I need to input the 3 enums. I can’t redeclare them in the main, so how can I input my enums with variable from the main?

  • 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-21T07:31:12+00:00Added an answer on May 21, 2026 at 7:31 am

    You have to specifiy which class the enums are defined in. So, e.g. call the function like this:

    OptimalPatrol(N, K, VS, T, Algoritem::W, Algoritem::OF, Algoritem::BR, Imax, P);
    

    That way, your compiler knows in which class to look for the enum declarations.

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

Sidebar

Related Questions

This is a simplified example. I have this enum declaration as follows: public enum
I have following problem: I have class public class HockeyActivity extends SimpleBaseGameActivity implements IOnSceneTouchListener,
I have problem with context menu. I have got: @Override public void onCreateContextMenu(ContextMenu menu,
Hi i have a problem, I try to do the follow, class A depends
package com.scheduler.process; public class Process { public enum state { NOT_SUBMITTED, SUBMITTED, BLOCKED, READY,
I have the following problem: Suppose I have some basic counter class Counter .
I have a problem with giving a template class a template friend in Sun
I have a problem with specifying the default values for my C++ class members.
I have a big problem. I created a WCF service.My POST declaration looks like
I have built a dropdown menu system, everything works when tested independently, the problem

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.