-3

I'm really new to C++ Programming and I'm trying to teach it myself. While I was having a look at some code I noticed the following:

#ifndef _someclass_h_
#define _someclass_h_

class A;
class B;
class C;

namespace somenamespace{

class SomeClass 
{
public: 

...
};
}

I'm confused about the classes A, B and C being declared outside of the namespace while not having any class body. What is done here? Does it have something to do with templates?

Thanks in advance!

kalu
  • 169
  • 1
  • 11

1 Answers1

0

These are forward declarations. C++ programmers use forward declarations to avoid having to include the header file for a class definition.

The classes A, B, and C are declared in the global namespace.

RichS
  • 540
  • 1
  • 6
  • 12