Solved

Please explain typedef statement -- Easy One

Posted on 1999-01-21
2
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

732 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