Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6995255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:59:54+00:00 2026-05-27T19:59:54+00:00

i have a class shown below: template <class TValue> class ICData { private :

  • 0

i have a class shown below:

template <class TValue>
    class ICData
    {
    private :
TValue value;
    public:
inline ICData()
{
};
TValue get_value();
void set_value(TValue data);
    };

    template <class TValue>
    TValue ICData<TValue>::get_value()
    {
return value;
    }

     template <class TValue>
     void ICData<TValue>::set_value(TValue _value)
     {
value=_value;
     }

i know how to make a pointer array by:

    ICData <int> *ICArray[10];
    ICArray[0]=new ICData<int>();
    ICArray[1]=new ICData<int>();

but is there any way to make a pointer array using template ? like below:

            template <class T>// iknow this code is WRONG
    ICData <T> *ICArray[10];
    ICArray[0]=new ICData<int>();
    ICArray[1]=new ICData<float>();

thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:59:54+00:00Added an answer on May 27, 2026 at 7:59 pm

    If you wanted to store a pointer that could point to either a ICData<int> or a ICData<float> then those types would have to have a common base class and you could use that common base as the type to point to.

    As it stands the type ICData<int> and ICData<float> are not related so other than using void * there is no solution to what you want to do that wouldn’t involve some ugly casts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a simple parent->child class structure as shown below Public Class
I new to flex, I have a class shown below: public class Items extends
I have a few classes as shown here public class TrueFalseQuestion implements Question{ static{
I have a property in WCF service class with a initial value, as shown
1- I have a class structure as shown below. namespace ViewStateSeoHelper { class ViewStateSeoModule
I have a class, the stub of which is shown below. Code analysis gripes
I have a class as shown below that stores a Uri object and also
I have a very simple class (shown below), however every time I run it,
I have a razor template like below. I want to check if the value
I have nested div as shown below: <div class=abc> <div class=bcd> </div> </div> I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.