Write only property : Property « Class « Visual C++ .NET






Write only property

 
#include "stdafx.h"
using namespace System;
ref class MyClass
{
    unsigned int atomic_number;

    public:
       property unsigned int MyValueNumber;
       property unsigned int MyInt
       {
            public: unsigned int get()
            {
                return atomic_number;
            }
            protected: void set(unsigned int n)
            {
                atomic_number = n;
            }
       }
};

ref class RadioactiveMyClass : MyClass
{
    public:

      void AlphaDecay()
      {
          MyInt -= 2;
          MyValueNumber -= 4;
      }
};

   
  








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.Property accessor delegate
8.Static property
9.Declaring properties
10.Virtual properties
11.Public properties can be used as named parameters