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

The Archive Base Latest Questions

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

Sorry guys!My bad…I should have posted my main function though. I was implementing a

  • 0

Sorry guys!My bad…I should have posted my main function though.

I was implementing a reverse polish notation calculator then I encountered this error which I could not figure any sort of clue out….

#include <iostream>
#include <string>
using namespace std;

class Exp {
  protected:
        string exp;
        int value;
  public:
        Exp();
        ~Exp();
        void setString(string s);//store conventional notation expression
        void setValue(int n);//store the corresponding value of the expression
        string getExp();//retrieve conventional notation expression
        int evaluate();//retrieve the corresponding value of the expression
  };


class unary : public Exp {
  public:
        void unaryyy(Expression *x,string op);
  };
 void unary::unaryyy(Expression *x,string op){
  if(op=="ABS"){
                               if(x->evaluate() > 0) setValue(x->evaluate());
                               else setValue(-x->evaluate());

                               string l="| ";
                               l.append(x->getExp());
                               l.append(" |");
                               setString(l);         
                                        }
                          else if(op=="NEG"){
                               setValue(-x->evaluate());
                               string m="- ";
                               m.append(x->getExp());
                               setString(m);
                               }
  }

  ...
 int main(){
 ...
 if(s=="ABS" || s=="NEG"){
        unary *a = new unary;
        a.unaryy(stack[p+1],s);
        stack[p+1]=a;
 ...
 }

Then,when debugging,the complier gave me a heads up that in main function,my ‘unaryy’ function has not been declared.

  • 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-26T21:54:34+00:00Added an answer on May 26, 2026 at 9:54 pm

    a.unaryy(stack[p+1],s);

    should be

     a->unaryy(stack[p+1],s); 
    

    -> should be used calling methods with pointers

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

Sidebar

Related Questions

Sorry guys, I posted this earlier today where my add as linked images were
Hello guys sorry if the question looks stupid to you. i have 3 tables
Sorry guys, if this is a stupid question. I have a set of integers
Sorry guys! i am so into the code! that i forgot to put the
I could be not more sorry guys - the question was a very wrong
Sorry for the wall of text guys but this one requires expliaining, way too
Ok guys, I'm really new at python (and programming itself) so sorry for my
Sorrry guys, I'm stuck here. I have a few grids, I also have CollectionViewSource
Sorry for the basic question - I'm a .NET developer and don't have much
Sorry for the bad title (couldn't think of a better way to describe it)

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.