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 |
Write a recursive program to calculate factorial in c++.
What is lazy initialization in c++?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
Which c++ operator cannot overload?
Write about the local class and mention its use?
Can you sort a set c++?
The "virtual" specifier in a member function enables which one of the following? a) Monmorphism b) Late binding c) Metamorphism d) Solomorphism e) Inheritance
implement stack using stack.h headerfile functions
1 Answers Exilant, GMG, Subex, University,
Why do we learn c++?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
Explain the difference between static and dynamic binding of functions?
What is lambda in c++?