Skip to content

Instantly share code, notes, and snippets.

@coldcue
Last active December 14, 2015 18:59
Show Gist options
  • Save coldcue/5133119 to your computer and use it in GitHub Desktop.
Save coldcue/5133119 to your computer and use it in GitHub Desktop.
#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