Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class A
- {
- public:
- //шаблонный сеттер
- template <typename T>
- T setValue(T value)
- {
- this->value = value;
- }
- //геттер
- int getValue() const
- {
- return value;
- }
- private:
- int value;
- };
- int main()
- {
- setlocale(LC_ALL, "Rus");
- srand(time(NULL));
- A a;
- a.setValue(3);
- std::cout << a.getValue();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement