What does a semicolon do after a C++ class name?


If you have statements like −

Class Person;

This is a forward declaration. It lets the following code 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.

Swarali Sree
Swarali Sree

I love thought experiments.

Updated on: 11-Feb-2020

262 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements