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

The Archive Base Latest Questions

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

everyone: Im creating a program that is able to create Matrices and and perform

  • 0

everyone:

Im creating a program that is able to create Matrices and and perform various operations on them for a course at school. They require us to overload the operators with with the appropriate Matrix Operations.

I am having a hard time with the following function:

typedef double matrixType;


using namespace std;


class Matrix{
protected:
    int m,n; // m:row size n:column size
    matrixType **a; //Allows us to acces the a(ij) i,j position of the matrix


//==================================================
// (==Operator)Verifies if two given Matrices are equal
//==================================================

bool Matrix::operator==(const Matrix &B){

bool flag=false;


if(B.m ==m && B.n ==n){

    for (int row=0; row<m; row++) {
        for (int col=0; col<n; col++) {
            if (B[row][col] != a[row][col]) {
                flag=false;
            }
        }
    }
    flag= true;
}

else{
    flag=false;

}

return flag;


}

Xcode warns me that at the following line:

 if (B[row][col] != a[row][col])

type ‘const Matrix’ doesn’t provide a subscript operator

Note: Function Headers,constructors and other functions have been omitted from this code portion.

Any help would be greatly appreciated.
Thank you.

  • 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-26T06:34:08+00:00Added an answer on May 26, 2026 at 6:34 am

    Given your implementation, it should be if (B.a[row][col] != a[row][col])

    BTW: You should read this page if you plan to implement your own matrix class.

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

Sidebar

Related Questions

I'm creating an intranet asp.net mvc application that everyone in the company should have
Prior to C# generics, everyone would code collections for their business objects by creating
Everyone managing open-source-software runs into the problem, that with the time the process of
Everyone who's done any web application development in Scala knows that you can use
I am creating a script that will show your computer information in Non-Geekeese. This
Hey everyone. I am using Appengine/Python and I haven't been able to fix a
I've a custom installer program that has worked fine, but it asks the user
I am writing a program that creates a stack using linked lists. I have
My app is creating a directory so that I can store log files in
Good day everyone. I am creating a calendar component, and I'm working in the

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.