Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- class A {
- public:
- A(){}
- int operator()(int a, int b) {
- return (a < b) ? a : b;
- }
- };
- class B :public A {
- private:
- A obj;
- int size;
- int *mas;
- public:
- B(int k):size(k) { mas = new int[k]; }
- void setmas() {
- for (int i = 0; i < size; i++) {
- std::cin >> mas[i];
- }
- }
- int getmin() {
- int min = mas[0];
- for (int i = 1; i < size; i++) min = obj(min, mas[i]);
- return min;
- }
- };
- void main() {
- B obj(5);
- obj.setmas();
- std::cout << obj.getmin();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement