Accessing a class from another class - bug!

I get a bug, and I don't know how to fix it, any help ?

background information: I have a class named Hello inside header file named Hello.h that wants to use some functions of class A in header file A.h, but class A is inside namespace a4.


1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include "A.h"
using namespace std;

// A is a class and the name of header file, and no this does not create any problems.
	class Hello : public A {      // Error on this line!
		private:
                    //...

		public:
                    //...
};



Error message:

Hello.h:10:40: error: expected class-name before ‘{’ token
class Hello : public A {
^
compilation terminated due to -Wfatal-errors.
Last edited on
but class A is inside namespace a4.


You aren't using it like it is, which is the problem.
If you want to access something inside a different namespace you could write namespace-name :: in front of it.
 
class Hello : public a4::A {
Last edited on
@firedraco, yes you are right, the problem was from the syntax.

@Peter87, yes that is the right way to do it. I figured it out later, but forgot to post it here. Thanks for the help!
Topic archived. No new replies allowed.