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
What is istream and ostream in c++?
Is c++ vector dynamic?
Which compiler does turbo c++ use?
What are signs of manipulation?
What is iostream in c++ used for?
What is the difference between #import and #include?
What is function prototyping?
What is the basic structure of a c++ program?
Should I learn c or c++ first?
What are c++ stream classes?
How to declaring variables in c++?
What is private inheritance?
What are the advantages of inheritance in c++?
Program to check whether a word is a sub-string or not of a string typed
What you know about structures in C++?