Home / MCQ Bank / Computer
Computer Classes And Objects In C Plus Plus Difficulty: Medium

Which operator should be overloaded in the following code to make the program error free? #include <iostream> #include <string> using namespace std; class Box{ int capacity; public: Box(){} Box(double capacity){ this->capacity = capacity; } }; int main(int argc, char const *argv[]) { Box b1(10); Box b2 = Box(14); if(b1 == b2){ cout<<"Equal"; } else{ cout<<"Not Equal"; } return 0; }

Select the correct option to test your answer:

More Computer Questions

What will be the output for the following code? #include <stdio.h> bool func(int arr[], int n, int sum) { if (sum == 0) return true; if (n == 0 && sum != 0) return false; if (arr[n-1] > sum) return func(arr, n-1, sum); return func(arr, n-1, sum) || func(arr, n-1, sum-arr[n-1]); } int main() { int arr[] = {4,6, 12, 2}; int sum = 12; int n = sizeof(arr)/sizeof(arr[0]); if (func(arr, n, sum) == true) printf("true"); else printf("false"); return 0; } If you see a diskette with a piece of foil covering its notch, it is said to be The primary advantage of key-to-tape data-entry systems is: 8 Bits make up a_________? What will be the output of the following R code? x <- c("a", "b", "c") > as.numeric(x)