title: Type casting in C++\CLI project
body: <p>I have project which I am compiling with /clr. I have a class like below..</p>
  
  <pre><code>ref class A
  {
  public:
   void CheckValue(void * test);
   typedef ref struct val
  {
   std::string *x;
  }val_t;
  
  };
  </code></pre>
  
  <p>in my implementation I ahve to use something like below..</p>
  
  <pre><code>void A::CheckValue(void *test)
  {
   a::val_t^ allVal = (a::val_t^)test;
  }
  </code></pre>
  
  <p>in my main I have used like..</p>
  
  <pre><code>int main()
  {
  A^ obj = gcnew A();
  a::val_t valObj = new std::string("Test");
  obj-&gt;CheckValue((void*)valObj);
  }
  </code></pre>
  
  <p>I am getting type cast error and two places - 
  obj->CheckValue((void*)valObj);
  and at 
  obj->CheckValue((void*)valObj);
  error C2440: 'type cast' : cannot convert from 'void*' to 'A::val_t ^'</p>
  
  <p>This snippet is just to show behavior at my end and I ahve to use it this way only. Earlier I was running it using non /clr so it compiled fine.</p>
  
  <p>Now question I have how can I make this type casting work in C++/CLI type project?</p>