Last active
December 14, 2015 18:59
-
-
Save coldcue/5133119 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Teglalap | |
{ | |
double a,b; | |
public: | |
Teglalap(double a=0, double b=0) : a(a), b(b) {} | |
const double getA() const {return a;} | |
const double getB() const {return b;} | |
const double terulet() const {return a*b;} | |
friend std::ostream& operator<<(std::ostream&, const Teglalap&); | |
}; | |
std::ostream& operator<<(std::ostream& o, const Teglalap& t) { | |
return o<<t.a<<'x'<<t.b; | |
} | |
double main() | |
{ | |
Teglalap teglalap(2,3); | |
std::cout<<teglalap; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment