C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 16)
16.
Which of the following concepts means adding new components to a program as it runs?
Data hiding
Dynamic typing
Dynamic binding
Dynamic loading
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
23 comments Page 2 of 3.

Suvarna said:   1 decade ago
Can anyone explain dynamic loading?

Ashok said:   1 decade ago
class shape { public:
void draw();
};
class circle : public shape { };
int main(int argc, char **argv){
circle my_circle;
my_circle.draw();
}

While this has all the usual advantages, e.g., code reuse, the real power of polymorphism comes into play when draw is declared to be virtual or pure virtual, as follows:

class shape{ public:
virtual void draw()=0;
};
class circle : public shape { public:
void draw();
}

Here, circle has declared its own draw function, which can define behavior appropriate for a circle. Similarly, we could define other classes derived from shape, which provide their own versions of draw.

Now, because all the classes implement the shape interface, we can create collections of objects that can provide different behavior invoked in a consistent manner (calling the draw member function). An example of this is shown here.

shape *shape_list[3]; // the array that will
// pointer to our shape objects
shape[0] = new circle; // three types of shapes
shape[1] = new square; // we have defined
shape[2] = new triangle;
for(int i = 0; i < 3; i++){
shape_list[i].draw();
}

Duude avinash(lpu) said:   1 decade ago
Provide separate programme on dynamic loading and dynamic binding.

Lillo said:   1 decade ago
Dynamic doesn't mean "multiple", it comes from Greek(movement).

It's something done during the program is "moving", while it's working, running.
(1)

Pavan kumar said:   1 decade ago
In OOPs Dynamic Binding refers to linking a procedure call to the code that will be executed only at run time. The code associated with the procedure in not known until the program is executed, which is also known as late binding.

Dynamic loading is a mechanism by which a computer program can, at run time, load a library (or other binary) into memory, retrieve the addresses of functions and variables contained in the library, execute those functions or access those variables, and unload the library from memory. Unlike static linking and loadtime linking, this mechanism allows a computer program to startup in the absence of these libraries, to discover available libraries, and to potentially gain additional functionality.

Ash said:   1 decade ago
Can someone provide a programming example with dynamic loading?

Ankita said:   1 decade ago
Difference between dynamic binding and dynamic loading?

Niks said:   1 decade ago
Why not dynamic binding ? what's the difference between the two ?

San said:   1 decade ago
Dynamic loading is a mechanism by which a computer program can, at run time, load a library (or other binary) into memory, retrieve the addresses of functions and variables contained in the library, execute those functions or access those variables, and unload the library from memory.

Harshita Nigam said:   1 decade ago
Can any one explain How can we use concept of dynamic loading ?


Post your comments here:

Your comments will be displayed after verification.