close-red

CS302 - Digital Logic Design

Question(s) similar to the following:

What are binary operators. Give an example of binary operators overloading using any class.

Question 1: What are binary operators. Give an example of binary operators overloading using any class.

Answer: Suggest Edit

Binary Operators Overloading

Binary operators act on two quantities.

Examples of binary operators:

overloading + operator:
class Complex{
private:
double real, img;
public:

Complex operator +(const Complex & rhs);
};
Complex Complex::operator +( const Complex & rhs){
Complex t;
t.real = real + rhs.real;
t.img = img + rhs.img;
return t;
}

Similar Questions:

Question 2: What are binary operators. Give an example of binary operators overloading using any class.

Answer: Suggest Edit

Binary Operators Overloading

Binary operators act on two quantities.

Examples of binary operators:

overloading + operator:
class Complex{
private:
double real, img;
public:

Complex operator +(const Complex & rhs);
};
Complex Complex::operator +( const Complex & rhs){
Complex t;
t.real = real + rhs.real;
t.img = img + rhs.img;
return t;
}
Past Papers of CS302 - Digital Logic Design
Sponsored

Attach VULMS for better learning experience!
Attach VULMS Account

Our VULMS adds features of MDBs and lets your populate VU subjects automatically.

Tajweed Classes (Learn Quran with Tajweed)
Learn Holy Quran with Tajweed

Try our 3 days free demo now! Online online holy quran tajweed classes are useful to learn reading holy quran with tajweed.

Gegasoft POS/CRM Software
Gegasoft Point of Sale/Customer Relationship Managemnet Software

Gegasoft Point of Sale/Customer Relationship Management software is an accounting software to fulfill your business needs.

Sponsored

?