When an object is instantiated, the constructor gets called ? How is this internally implemented ? Who Calls the Constructor ? Is it the OS ?

Constructor is inbuilt in g++ compiler.
when object is instantiated, compiler invokes it

The compiler adds code to the program to call the constructor.

[edit]^^^ What Jerry said too. [/edit]

For your information, although whenever you declare a class type variable, an internally defined constructor will be called, it is still a good habit to define personally your own constructor.

thanks !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.