void* and arrays

  • Thread starter Thread starter Nanditha Chandra
  • Start date Start date
N

Nanditha Chandra

Hi!

I have a newbie question regarding void*. I am reposting this since I
am still not clear.

In native C++ you can have a function that takes a void* and you can
call that function with pointer to array or any other kind for that
matter. Here is an example

Foo(void*);

// You can later call this foo() as

short* shbuf = new buf[100];
foo(shbuf);

long lx = 1;
foo(&lx);

etc.

In MC++, is there a way to do this. I need a generic function that can
be used with value types or arrays of value types. I cannot use
Object* since Foo() will be called with value types or arrays of value
types most of the time.

Thanks,
D
 
Back
Top