This question is an exact duplicate:
There is a class for representing a two-dimensional dynamic array. The number of columns and columns is indicated through the constructor, and dynamic memory is allocated there. Next, the array must be filled from the keyboard via an overloaded input statement, but an error occurs: Exception thrown: read access violation. 
Here is the code itself:
#include <iostream> using std::cout; using std::cin; using std::endl; using std::istream; using std::ostream; class IntArr { friend istream& operator >> (istream &in, IntArr& a) { for (int i = 0; i < a.rows; i++) { for (int j = 0; j < a.cols; j++) { in >> a.pa[i][j]; } } return in; } private: int **pa; int rows, cols; public: IntArr() { pa = 0; rows = 0; cols = 0; } IntArr(int rows, int cols) { this->rows = rows; this->cols = cols; int **pa = new int*[this->rows]; // две строки for (int count = 0; count < this->rows; count++) { pa[count] = new int[this->cols]; // и пять столбцов } } }; int main() { IntArr first(3, 4); cin >> first; system("pause"); return 0; } I would be grateful for the help