How to get the effective definitions of classes

J

James Harris

Am fairly new to C++ and trying to understand the class hierarchy of
an existing body of code that I have to work with. The way the code is
defined (many files, significantly deep class hierarchy and
conditional includes) makes it especially difficult to work out what
the classes I have to work with actually look like.

Any suggestions on how to understand the effective make-up of
individual classes and how the class hierarchy is put together?

Maybe there is a tool to do this. g++'s -fdump-class-hierarchy seems
more about vtables. All I want to see is something along the lines of

class C
member variable V
member variable V
member function F
member function F

etc. and for each member a note of its type and where it is defined.

Anyone know of a way to get this info?

James
 
J

Jorgen Grahn

Am fairly new to C++ and trying to understand the class hierarchy of
an existing body of code that I have to work with. The way the code is
defined (many files, significantly deep class hierarchy and
conditional includes)

Unless they're doing really bizarre things (like having
myclass_version_one.h and myclass_alternate_version.h),
conditional includes shouldn't affect anything here.
They do make navigation harder for humans though.
makes it especially difficult to work out what
the classes I have to work with actually look like.

Any suggestions on how to understand the effective make-up of
individual classes and how the class hierarchy is put together?

Maybe there is a tool to do this. g++'s -fdump-class-hierarchy seems
more about vtables. All I want to see is something along the lines of

class C
member variable V
member variable V
member function F
member function F

etc. and for each member a note of its type and where it is defined.

Anyone know of a way to get this info?

I tend to use Doxygen on code I'm unfamiliar with. Make it generate
HTML documentation with class diagrams as pictures.

Then when I know the code a bit better, I use pen and paper.

/Jorgen
 
G

Gerhard Fiedler

James said:
Any suggestions on how to understand the effective make-up of
individual classes and how the class hierarchy is put together?

Maybe there is a tool to do this. g++'s -fdump-class-hierarchy seems
more about vtables. All I want to see is something along the lines of

class C
member variable V
member variable V
member function F
member function F

etc. and for each member a note of its type and where it is defined.

Anyone know of a way to get this info?

Try Doxygen <http://www.stack.nl/~dimitri/doxygen/>. It's a
documentation tool that can extract information like this.

Gerhard
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top