Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > typedefs and namespaces

Reply
Thread Tools

typedefs and namespaces

 
 
alariq
Guest
Posts: n/a
 
      01-29-2010
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.
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      01-29-2010
alariq wrote:
> 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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
 
alariq
Guest
Posts: n/a
 
      01-29-2010
On Jan 29, 6:45*pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:
>
> Use the function to do *what*?


Blind I am! Thank you Viktor. I guess, it just was not my hard day
today...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Implicit typename, typedefs, and inheritance lutorm C++ 1 05-20-2005 11:16 PM
Forward declaration and typedefs Simon Elliott C++ 5 01-07-2005 10:02 PM
circular dependencies and typedefs Dylan C++ 7 07-07-2004 06:59 PM
Templates and Typedefs dwrayment C++ 6 08-14-2003 05:52 AM
STL typedefs and base class pointer problem emerth C++ 3 08-08-2003 05:47 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57