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 |
What is an object in c++?
What is the use of volatile variable?
What is an explicit constructor?
You're given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above.
How do you master coding?
What is the return value of the insertion operator?
What is the array and initializing arrays in c++?
What is encapsulation in c++ with example?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
make a middle node of doubly linklist to the top of the list
In which memory a class gets stored(in heap /in stack)? And why??
Difference between a homogeneous and a heterogeneous container