C++/c++

Advertisement


Question
hello sir i am reading polymorphism in c++.polymorphism is two types.
1)compile time polymorphism 2)run time polymorphism.
then what is meant by run time?what is meant by compile time?what modifications are done to source code in compile timeand runtime.?
i have referred some books.but they are not giving ans to above questions.they merely discuss only topics of poly morphism.please give detailed ans to my questions.

Answer
Compile-time is the time when your source code is being compiled. Templates are instantiated at compile-time.

Run-time is when the compiled program is executed. Source code is not required at all at run-time.


For example, if you have the following program:

#include <iostream>

int main()
{
   std::cout << "Hello World!\n" ;
}

This could be compiled once - the source code is translated into executable code at this time.

Once successfully compiled, the program can be run many times. Every time it runs, we have 'run-time'.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.