Untitled
unknown
plain_text
a year ago
677 B
3
Indexable
Never
#include <iostream> #include <vector> #include <random> using namespace std; class A{ protected: int a; public: A() { a = 15; } }; class B : public A{ int* Ax; int x; public: B(int x) { this->x = x; this->Ax = new int[x]; for (int i = 0; i < x; ++i) { int start = 0; int end = 30; int y = rand() % (end - start + 1) + start; Ax[i] = a * y; } } void Show() { for (int i = 0; i < x; i++) { cout << Ax[i] << " "; } cout << endl; } }; int main() { B a(5); a.Show(); }