Thanks for the replies.


So constructor do allocate memory for objects right?

In this case the PoweredDevice is created by Copier directly, and then Scanner and Printer inherit the members from PoweredDevice, but how does Copier inherits the members from Scanner and Printer?

Because Printer and Scanner rely on PoweredDevice and it is necessary to create it before either of these 2.
But in this case PoweredDevice is created first which is non-virtual base.

Binding is a process by which, which function (whether base class or derived class's function) to be invoked is determined.

For normal functions, this is determined at compile time based on the object type calling it

For virtual functions, this is determined at runtime based on the object pointed (or referenced) by the base pointer (or reference).

The late binding allows the program to execute to different functions based on the what the pointer (or reference) points to.
Reply With Quote
Yes, I have heard about binding proccess, but I do not make difference (or I can understand) why (is there any reason) that it should be run-time and not compile time.