?
Solved

Please explain typedef statement -- Easy One

Posted on 1999-01-21
2
Medium Priority
?
266 Views
Last Modified: 2012-08-14
What type does TYPELIB_DATA end up being??
Please explain as to a newbie.
Thanks in advance.

typedef CTypedPtrArray<CPtrArray, CTypeLibraryData*> TYPELIB_DATA;
0
Comment
Question by:shark351
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1184818
TYPELIB_DATA is a type, that is what typedef does: it creates new types.

The type of TYPELIB is a CTypedPtrArray. But CTypedPtrArray is different in that it is a template class. So the stuff in between the < and > indicate how the template is specialized. In this case, CPtrArray and CTypeLibraryData*.

CPtrArray is the class that provides the implementation of how CTypedPtrArray should work. The CTypeLibraryData* is the type of data to be stored in the array.

So ultimately, TYPELIB_DATA is an array of pointers to CTypeLibraryData.
0
 
LVL 1

Expert Comment

by:Aggarwal
ID: 1184819
typedef doesn't create a new type , it creates a new name for an existing  type .

typedef creates a new name "TYPELIB_DATA" to an existing type "CTypedPtrArray<CPtrArray, CTypeLibraryData*>" , its very much clear that CTypedPtrArray is a template class .
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question