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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:25:59+00:00 2026-06-03T02:25:59+00:00

I need to do some logical comparison and return a boolean answer. Here is

  • 0

I need to do some logical comparison and return a boolean answer.

Here is the code from the .cpp file:

bool MyString::operator==(const MyString& other)const
{
    if(other.Size == this.Size)
    {
            for(int i = 0; i < this.Size+1; i++)
            {
                    if(this[i] == other[i])

                            return true;
            }
    }
    else
            return false;
}

Here is what is called from main.cpp file:

 if (String1 == String4)
 {
    String3.Print ();
 }
 else
 {
     String4.Print ();
 }

Here are there compiling errors I get:

error: request for member `Size` in `this`, which is of non-class type `const MyString* const`
error: no match for `operator[]` in `other[i]`
  • 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-03T02:26:01+00:00Added an answer on June 3, 2026 at 2:26 am

    Problems with your code:

    • this[i]: You apparently want to access the ith character of the string here. This isn’t doing that. Assuming your class overloads operator[], you want (*this)[i]. Alternatively, you could directly access the internal representation of the string.

    • if(this[i] == other[i]) return true;: Think about what this means with respect to comparing the strings “A1” and “AB”.

    • for () {...}: What happens when you exit the loop? You need to return something if the comparisons manage to make it through the loop without returning.

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

Sidebar

Related Questions

Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
Need some best practice advice here... Navigation based application. Root view is a UITableView
I need to convert integer value into hexadecimal. I have done with some logical,
I need to expose some logic locally as a service… The objects sent/received to/from
I have a need to evaluate user-defined logical expressions of arbitrary complexity on some
I used to run my Java code with Hibernate to mysql. Some logical changes
From a logical point of view an application may need dozens or hundreds of
I want/need to do some more or less complex logical queries in Sol:r and
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview

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.