Property accessor delegate : Property « Class « Visual C++ .NET






Property accessor delegate

 

#include "stdafx.h"

using namespace System;

delegate double ValueAccessor();

value class MyClass
{
   public:
     property double MyDouble;
};

int main()
{
  MyClass myobject;
  myobject.MyDouble = 15.9994;
  ValueAccessor^ get_method = gcnew ValueAccessor(myobject,&MyClass::MyDouble::get);

  Console::WriteLine("{0}", get_method->Invoke());
}

   
  








Related examples in the same category

1.Array Property
2.Static Property
3.Scalar number Property
4.Defining Index Properties
5.Indexed properties
6.Indexed properties 2
7.Static property
8.Declaring properties
9.Write only property
10.Virtual properties
11.Public properties can be used as named parameters