using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
enum TokenType { ID, NUM, WS, ERROR, EOF}
class Token
{
private string _lexeme;
private TokenType _type;
public Token(TokenType type, string lexeme)
{
_type = type;
_lexeme = lexeme;
}
public string Lexeme { get { return _lexeme; } } // that is the statement i need to have its meaning
public TokenType Type { get { return _type; } }
}
any body can help me?;)
}
1 reply to this topic
#1
Posted 24 April 2011 - 08:07 AM
|
|
|
#2
Posted 24 April 2011 - 01:15 PM
This is called accessor method and is used to get value of that field/property.
When you write <class object>.Lexeme it will read the private field lexeme's value. The advantage is you can allow easy ways for people read class's private field's value.
If you do not add a corresponding set, then one can read but cannot change the value. Have a look at following msdn article
get (C#)
When you write <class object>.Lexeme it will read the private field lexeme's value. The advantage is you can allow easy ways for people read class's private field's value.
If you do not add a corresponding set, then one can read but cannot change the value. Have a look at following msdn article
get (C#)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









