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

Recommended Answers

All 3 Replies

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(_)[|<.

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(_)[|<.

I found the solution

private:
int X;

public:

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

Enjoooooooooooy!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.