building of Matrix on OOP