In this article we obtain a new anisotropic solution for Einstein's field equations of embedding class one metric. The solution represents realistic objects such as Her X-1 and RXJ 1856-37. We perform a detailed investigation of both objects by solving numerically the Einstein field equations with anisotropic pressure. The physical features of the parameters depend on the anisotropic factor i.e. if the anisotropy is zero everywhere inside the star then the density and pressures will become zero and the metric turns out to be flat. We report our results and compare with the above mentioned two compact objects as regards a number of key aspects: the central density, the surface density onset and the critical scaling behaviour, the effective mass and radius ratio, the anisotropization with isotropic initial conditions, adiabatic index and red shift. Along with this we have also made a comparison between the classical limit and theoretical model treatment of the compact objects. Finally we discuss the implications of our findings for the stability condition in a relativistic compact star.