Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <memory>
- #include <list>
- class Name
- {
- public:
- Name()
- {
- std::cout << "Name" << std::endl;
- }
- virtual ~Name() {};
- Name operator+(int rhs)
- {
- val += rhs;
- return *this;
- }
- Name& operator=(int rhs)
- {
- val = rhs;
- return *this;
- }
- friend std::ostream& operator<<(std::ostream& os, const Name& c)
- {
- os << c.val;
- return os;
- }
- private:
- int val { 0 };
- };
- int main(int argc, char *argv[])
- {
- Name n;
- (n + 1) = 40;
- std::cout << n << std::endl;
- const char* n2 = "maciejek";
- std::cout << std::string(n2, 2) << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement