Using pointer arithmetic on the interior pointer : Pointer « Data Type « Visual C++ .NET






Using pointer arithmetic on the interior pointer

 

#include "stdafx.h"
using namespace System;

ref class MyObject
{
};

int main()
{
   array<MyObject^>^ array_of_buf = gcnew array<MyObject^>(10);

   for each (MyObject^ bref in array_of_buf)
   {
      bref = gcnew MyObject();
   }
   interior_ptr<MyObject^> ptr_buf;
   for (ptr_buf = &array_of_buf[0]; ptr_buf <= &array_of_buf[9]; ptr_buf++)
   {
      MyObject^ buf = *ptr_buf;
      // use the MyObject class
   }
}

   
  








Related examples in the same category

1.Address Indirect
2.Int pointer
3.Pointer To String Chars
4.Int Pointer with gcnew
5.Int Pointer Arithematic