Computer Science, asked by shurti7474, 1 year ago

Why can't we initialise variables in class why to use constructors in cpp?

Answers

Answered by GyaniRishabh2005
0
Hlo mate,

The compiler calls the constructor after the new object has been allocated in memory, and converts that "raw" memory into a proper, typed object. The constructor is declared much like a normal member function but it will share the name of the classand it has no return value.
Similar questions