Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class CelsiusDeg {
- double value;
- public:
- CelsiusDeg() {
- value = 10;
- }
- CelsiusDeg(double value) {
- this->value = value;
- }
- double operator +(const CelsiusDeg & c) {
- return double(this->value + c.value);
- }
- };
- class Kelvin {
- double value;
- public:
- Kelvin() {
- value = -273;
- }
- Kelvin(double value) {
- this->value = value;
- }
- };
- int main() {
- CelsiusDeg celciusDeg1;
- CelsiusDeg celciusDeg2(37);
- Kelvin kelvin1;
- Kelvin kelvin2(10);
- double sum = celciusDeg1 + celciusDeg2;
- std::cout << sum << std::endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement