
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are forward declarations in C++?
Forward declaration lets the code following the declaration know that there is are classes with the name Person. This satisfies the compiler when it sees these names used. Later the linker will find the definition of the classes.
example
Class Person; void myFunc(Person p1) { // ... } Class Person { // Class definition here };
So in this case when the compiler encounters myFunc, it'll know that it's going to encounter this class somewhere down in the code. This can be used in cases where code using the class is placed/included before the code containing the class definition.
- Related Questions & Answers
- What are Declarations?
- Do we need forward declarations in Java?
- What are JSP declarations? In how many ways we can write JSP declarations?
- What is typedef declarations in C++?
- What are characteristics of forward contracts?
- Array Declarations in C#
- What are forward triangular merger and reverse triangular merger?
- What are the rules for external declarations in JShell in Java 9?
- C# Multiple Local Variable Declarations
- What are the reverse merger, forward merger and subsidiary merger?
- What is the forward contract?
- forward list::cend() in C++ STL
- Array Declarations in Java
- What is Feed-Forward Neural Networks?
- Forward list assign() function in C++ STL
Advertisements