TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
324k
this reference
Mar 5 2012 10:17 AM
In a book examples,
this
reference is used within the instance method & in constructor. That means used within the get() and set() method and in constructor.
In my view if you are using
this
reference within set() method you don't need to use within the get() method. I wish to know whether my understanding is correct. I enclosed an example program.
using System;
namespace _7e7
{
class Program
{
static void Main(string[] args)
{
Salesperson sp = new Salesperson("Hendry Ford");
Console.WriteLine(sp.getSalesPfullName());
Console.ReadKey();
}
}
}
class Salesperson
{
string name;
public Salesperson(string name)
{
this.name = name;
}
public string getSalesPfullName()
{
return name;
//
N
ote: no
this
reference is used
}
}
/*
Hendry Ford
*/
Reply
Answers (
3
)
How to restart the router by programatically using c#
Customize menu based on database ( convert from VB )