Computing.Net > Forums > Programming > C++ Data Structures multiple differ

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ Data Structures multiple differ

Reply to Message Icon

Name: krisreid
Date: September 30, 2004 at 16:17:31 Pacific
OS: XP
CPU/Ram: 1.8 1024
Comment:

In java you have the Object data type so you can store an array of Objects then cast them to the object you want when you pull them out.

I want to do the same kind of thing in c++.
I need a data structure, anything will do, that can hold an unknown number of unknown objects.

Is this possible? Or am I dreaming

thanx



Sponsored Link
Ads by Google

Response Number 1
Name: egkenny
Date: September 30, 2004 at 19:39:19 Pacific
Reply:

You might want to look at the C++ STL or even class templates. Class templates uses the same concepts that are in the C++ STL but are user defined. An example is:

template <typename T>
class MisterEd{
public:
void func1(T const v1);
void func1(T const v1, T const v2);
private:
T d1;
T d2;
};


0

Response Number 2
Name: Infinite Recursion
Date: October 1, 2004 at 07:19:06 Pacific
Reply:

Yes, STL is the way to go... look into containers and templates.

http://www.sgi.com/tech/stl/


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


do while loops Performing Action on Java...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ Data Structures multiple differ

c(data structures) programming help www.computing.net/answers/programming/cdata-structures-programming-help/6359.html

Data Structure through 'C' www.computing.net/answers/programming/data-structure-through-c/6256.html

Which data structure to use? www.computing.net/answers/programming/which-data-structure-to-use/8164.html