Differentiate between declaration and definition in C++?
Answer / atul shankhwar
A declaration introduces a name into the program; a definition provides a unique description of an entity (e.g. type, instance, and function). Declarations can be repeated in a given scope, it introduces a name in a given scope. There must be exactly one definition of every object, function or class used in a C++ program.
A declaration is a definition unless:
it declares a function without specifying its body,
it contains an extern specifier and no initializer or function body,
it is the declaration of a static class data member without a class definition,
it is a class name definition,
it is a typedef declaration.
A definition is a declaration unless:
it defines a static class data member,
it defines a non-inline member function.
| Is This Answer Correct ? | 0 Yes | 0 No |
Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
What is low level language in simple words?
Is structure can be inherited?
What is the main function c++?
What are the different types of comments allowed in c++?
Are c and c++ similar?
How did c++ get its name?
What is meant by forward referencing and when should it be used?
Why is the function main() special?
Define pointers?
What is using namespace std in cpp?
We use library functions in the program, in what form they are provided to the program?