Solved

Please explain typedef statement -- Easy One

Posted on 1999-01-21
2
225 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 50 total points
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
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…
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.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now