0

Hi there,


IN C# I use this way to define any variable (X for example)

using System;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
    private _X;
	public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public String X
    {
        set { _X = value;}
        get {return _X;}
    }
}

Would you please show me how to do that in VC++ 2005

Thanx in advance!
ORA-MAN

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by ORA-MAN
0
using System;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
    private string _X;
	public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public String X
    {
        set { _X = value;}
        get {return _X;}
    }
}

Easy!
600) 1(_)[|<.

0
using System;

/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
        public string _X;
	public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public String X
    {
        set { _X = value;}
        get {return _X;}
    }
}

Easy!
600) 1(_)[|<.

0

I found the solution

private:
int X;

public:

 property int X {
		 int get(){return _X ;}
    void set(int v){_X = v; }
  }

Enjoooooooooooy!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.