Re: help: tips from c++ api writers
I don't really know c++ but...I heard that you can extract info from header files... ?...
I have understanding from Java code... but am not sure how different this may be for c++. Are header files in text format or do I need Visual Studio to view these?
One of the main differences between Java and C++ is
the logical structure of the code. Java stores all
the information about the class in a single file and
when it generates bytecode, all of the information
about the code disappears into neverneverland. That's
why javadocs comes with, so you can see what's inside.
C++, OTOH, stores information about the class in the
header file (.h) and the implementation (mostly) for the
class goes in the source file (.c, .cpp, etc. depending
on the compiler). When you compile c++ code, the
implementation goes to neverneverland; the header file
remains in plain text. <TIC> That's why *real* c++
programmers don't need no stinkin' reference docs!</TIC>
;-) They can always browse the header files to see
what the library includes.
What you see in the header file is the definition for
the class. It:
* uses include statements to call in functionality
from other classes
* declares the name of the class
* lists one or more parent classes
* declares the signatures for all the methods
in the class (some methods may be implemented
in-line, even though this circumvents encapsulation)
* declares the data members for the class
While Java, with a few exceptions, follows a one-class/
one-file model, I've seen upwards of 200 classes declared
in a single header file.
The syntax and the method signatures are very similar, so
you shouldn't have too much trouble there.
One difference that you'll find is that Java uses access
modifiers in front of every element while c++ uses access
modifiers as section identifiers.
Additionally, you'll need to pay attention to the differences
in polymorphism. In java, polymorphism is the default and you
need to use the _final_ keyword to turn it off. In c++, you
need to specifically turn polymorphism _on_ using the keyword
_virtual_.
The java _interface_ equates to the c++ abstract base class
in that it is impossible to instantiate an object in either
case. Declaring an abstract base class in c++ is simply a
matter of setting a virtual method equal to zero within a
class declaration. So it's certainly not as obvious as in
Java, where you declare an interface rather than a class.
Be sure that you point out abstract base classes and the
methods that are set equal to zero (in c++, those are called
_pure_virtual_methods_).
One of the nice things about Java is that it has automatic
garbage collection and it doesn't have pointers. Pointers
are a very powerful, *PIA* feature of c++ where you point
to where the data is stored instead of calling the data
by name (sort-of). Pretty much all you need to know from
a documentation POV is that whenever you see either an
asterisk or "_ptr" in the return value, you need to tell
the audience whether it's their responsibility to release
the memory when they're done with it. Not releasing the
memory causes memory leaks causes programs to crash, so
that's important.
HTH! Feel free to email me with any other questions, but
I suggest we take more specific questions offline before
everybody else's eyes glaze over. <giggle!>
-Sue Gallagher
susanwg -at- ix -dot- netcom -dot- com
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*** Deva(tm) Tools for Dreamweaver and Deva(tm) Search ***
Build Contents, Indexes, and Search for Web Sites and Help Systems Available 4/30/01 at http://www.devahelp.com or info -at- devahelp -dot- com
Sponsored by DigiPub Solutions Corp, producers of PDF 2001 Conference East, June 4-6, Baltimore, MD. Now covering Acrobat 5. Early registration deadline April 27. http://www.pdfconference.com.
---
You are currently subscribed to techwr-l as: archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit http://www.raycomm.com/techwhirl/ for more resources and info.
Previous by Author:
Re: HTML Help
Next by Author:
Re: Looking for "best of breed" developer/API docs
Previous by Thread:
RE: help: tips from c++ api writers
Next by Thread:
RE: help: tips from c++ api writers
Search our Technical Writing Archives & Magazine
Visit TechWhirl's Other Sites
Sponsored Ads