Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ I have a class that has an array of size 100. However, this 100 might not be used entirely, so I have a variable

c++

I have a class that has an array of size 100. However, this 100 might not be used entirely, so I have a variable called size that would keep track of number of elements in each object I declare of type Myclass. I need to overload the equality operator(==) through a function that will compare two objects of type Myclass and return true if they are equal. In other words, all elements of array of object one are there in object two with same size of elements for both. The order of the elements doesn't matter.

so if these two objects have the following values in the arrays:

s1: 1 2 4 5

hence size of this is 4

s2: 5 4 2 1

also the size is 4

now the overlaoding function should return true if I type this code:

s1==s2

sample of my class:

class Myclass {

int set[100];

int size;

};

I don't need a full class and code.. just a code that implements overloading the == operator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

ISBN: 0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

Explain what is meant by organisational jargon

Answered: 1 week ago