CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Apr 2002
    Posts
    61

    copying unknown datatypes

    I have a variable in a templated class (A) that I want to be able to change from a wrapper class (B). The data type of A changes with each instance (string, int, float...), but what I'm wondering is if I can create a universal member function in B that will set the value in A?
    would it be possible to

    a = malloc(sizeof(*newVal));
    strcpy(a, newVal);

    where

    template <class T>
    class A
    {
    public:
    T * a;
    }

    and

    void * newVal;

    is this possible? and am I making sense?
    Last edited by DevLip; April 12th, 2004 at 12:00 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured