typedefs and namespaces

A

alariq

Hello, All
can anyone help me with my problem. Here is it
I have one file: a.h
--- a.h ---
#pragma once
class Value; // forward declaration

namespace a {
// probably i would like to create Joint class as separate but now
i want to use Value class
typedef ::Value Joint;
class A_Class {
};

class C {
public:
//...
Joint* j;
};
} // end of namespace

and another class b.h, which includes a.h
--- b.h ---
#pragma once
#include "a.h"

class Value {
a::A_Class* pclass;
public:
static Value* makeStuff() { return new Value; }
}

and a main class
--- main.cpp ---
#include "b.h"
#include "a.h" // not really needed

int main(int argc, char** argv)
{

a::C var2;
var2.j = new a::Joint::makeStuff(); // error C2061: syntax error :
identifier 'makeStuff'
return 0;
}

I canot get why i have an error, becuase a::Joint is the same as
Value. It is ok if i do not use the function but fails if i do.

Thanks in advance.
 
V

Victor Bazarov

alariq said:
Hello, All
can anyone help me with my problem. Here is it
[...]

and a main class
--- main.cpp ---
#include "b.h"
#include "a.h" // not really needed

int main(int argc, char** argv)
{

a::C var2;
var2.j = new a::Joint::makeStuff(); // error C2061: syntax error :
identifier 'makeStuff'

The compiler expects a *type* after 'new'. For example,

var2.j = new a::Joint;

What is it you're trying to accomplish here?
return 0;
}

I canot get why i have an error, becuase a::Joint is the same as
Value. It is ok if i do not use the function but fails if i do.

Use the function to do *what*?

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top