Solved

Please explain typedef statement -- Easy One

Posted on 1999-01-21
2
241 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

763 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