[gameprogrammer] Re: Cast by return type?

  • From: "Husam Zakaria" <hzcppff@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Sun, 30 Mar 2008 03:15:51 +0300

sure you can in C++, just like that:

struct MyStruct
{
   char *s;
   operator float* ( ) { return s;}
   operator const float*( ) const { return s; }
};

so you can do something like this:

MyFunc(char * s)
{

}

MyStruct  myStruct;

MyFunc(myStruct);

Other related posts: