Differentiate between declaration and definition in C++?
Answer Posted / 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 |
Post New Answer View All Answers
Explain binary search.
How to demonstrate the use of a variable?
why is c++ called oops? Explain
What character terminates all character array strings a) b) . c) END
How would you use the functions sin(), pow(), sqrt()?
What is the difference between struct and class?
Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort
In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h
an integer constant must have atleast one a) character b) digit c) decimal point
What is the extension of c++?
what kind of projects are suitable for c and c++
What is an associative container in c++?
Do vectors start at 0 c++?
What is a friend function in c++?
Can constructor be private in c++?