namespace, forward class definitions (and "using")

René J.V. Bertin rjvbertin at
Tue Apr 10 14:20:48 UTC 2018

On Tuesday April 10 2018 14:42:56 Kevin Funk wrote:


> I've read your mail twice and I still cannot figure out what exactly you're
> trying to do.

In more of a nutshell: I want to add 2 classes to topducontextsdynamicdata.cpp (say A and B, where "using B = A"). I'll only use the classes in that file but some of the member functions of the exported classes defined in topducontextsdynamicdata.h will receive pointers to the new class B.
The basic question is: can I put only a forward definition to class A in the header file, plus the "using B = A" statement and if so, how?

In the attempts I made, I got errors about a mismatch between the implementation of a class A and the forward definition of a class KDevelop::A (or the opposite). Those disappeared when I replaced the class A forward definition with the complete definition and left only the out-of-line implementation in topducontextsdynamicdata.cpp .

>(This question is probably more geared towards a C++ programming community 
>audience, at any rate)

Yeah, it's a generic C++ programming question, but since it's related directly to what I'm trying to do with topducontextsdynamicdata.* I thought I'd ask here first. The kdevelop-devel ML memberlist is a C++ programming (or programmers) community, no? :)

I'll see if I can reproduce the issue in a minimum example, or else invoke the question again when I post a phab diff of the actual experiment I'm writing.



More information about the KDevelop-devel mailing list