Question
class complex{
double re;
double im;
public:
complex() : re(1),im(0.5) {}
bool operator==(complex &rhs);
operator int(){}
};

bool complex::operator == (complex &rhs){
if((this->re == rhs.re) && (this->im == rhs.im))
return true;
else
return false;
}

int main(){
complex c1;
cout<< c1;
}

Answers

Answer : Garbage value

Explanation:
The programmer wishes to print the complex object using output
re-direction operator,which he has not defined for his lass.But the compiler instead of giving an error sees the conversion function
and converts the user defined object to standard object and prints
some garbage value.   Your Comment




More Software,operator Questions..
What is the inputsplit in map reduce software?

What is software configuration management?

What is the purpose of . Operator?

Define scope resolution operator?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?

What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?

Which oracle package is used to manage the oracle lock management services?

What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?



Search
Can you Answer!!
  • Q What is the maximum length for a file name under linux?
  • Q What is the evaluation of alternatives?
  • Q Describe about query/400?
  • Q What are the various stress management techniques that you are aware of?
  • Q Is it appropriate for an IS auditor from a company that is considering outsourcing its IS processing to request and review a copy of each vendor's business continuity plan? A. Yes, because the IS auditor will evaluate the adequacy of the service bureau's plan and assist his/her company in implementing a complementary plan. B. Yes, because, based on the plan, the IS auditor will evaluate the financial stability of the service bureau and its ability to fulfill the contract. C. No, because the backup to be provided should be specified adequately in the contract. D. No, because the service bureau's business continuity plan is proprietary information.
  • Q The study of races:
  • Q What is drip irrigation?
  • Q Does edb help me find partners for sourcing or joint ventures in the state of andhra pradesh?
  • Q What does the "abstract" keyword mean in front of a method? a class?
  • Q In astrology what was the age before Aquarius
  • Q What is the difference between the ad engine (AE) and bid engine (BE)?