473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

what does the term 'state data' mean?

In a book i'm reading i've just ventured into chapter 3 - C# language
fundamentals.
Now i can see that the first part of the code after the class
definition defines a public variable, of type string, called
userMessage. But I don't understand the term 'point of state data' can
someone clarify that for me please.

TIA. Gary-

I've just encountered the following sample code: -

// HelloClass, with constructors.
using System;
class HelloClass
{
// A point of state data.
public string userMessage;

// Default constructor.
public HelloClass()
{ Console.WriteLine("Default ctor called!"); }

// This custom constructor assigns state data
// to a user-supplied value.
public HelloClass (string msg)
{
Console.WriteLine("Custom ctor called!");
userMessage = msg;
}

// Program entry point.
public static int Main(string[] args)
{

// Call default constructor.
HelloClass c1 = new HelloClass();
Console.WriteLine("Value of userMessage: {0}\n", c1.userMessage);

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Testing, 1, 2, 3");
Console.WriteLine("Value of userMessage: {0}", c2.userMessage);
Console.ReadLine();
return 0;
}
}

Dec 20 '06 #1
3 1827
I think it should say a 'piece' of state data. State data is a term for
pieces of information held in variables in an instance of a object. Together
all these pieces of information constitute the current 'state' of the object.
--
Ciaran O''''Donnell
http://wannabedeveloper.spaces.live.com
"ga********@myway.com" wrote:
In a book i'm reading i've just ventured into chapter 3 - C# language
fundamentals.
Now i can see that the first part of the code after the class
definition defines a public variable, of type string, called
userMessage. But I don't understand the term 'point of state data' can
someone clarify that for me please.

TIA. Gary-

I've just encountered the following sample code: -

// HelloClass, with constructors.
using System;
class HelloClass
{
// A point of state data.
public string userMessage;

// Default constructor.
public HelloClass()
{ Console.WriteLine("Default ctor called!"); }

// This custom constructor assigns state data
// to a user-supplied value.
public HelloClass (string msg)
{
Console.WriteLine("Custom ctor called!");
userMessage = msg;
}

// Program entry point.
public static int Main(string[] args)
{

// Call default constructor.
HelloClass c1 = new HelloClass();
Console.WriteLine("Value of userMessage: {0}\n", c1.userMessage);

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Testing, 1, 2, 3");
Console.WriteLine("Value of userMessage: {0}", c2.userMessage);
Console.ReadLine();
return 0;
}
}

Dec 20 '06 #2
Hi Gary,

"State" is data that is persisted for the lifetime of an instance of an
object (although "state" can also be "static", which means it's shared by
every instance of a class). In other words, when you set the "userMessage"
field its value will remain the same until its either changed or the object
is collected by the GC.

I've never heard of the phrase "point of state", however.

--
Dave Sexton

<ga********@myway.comwrote in message
news:11**********************@80g2000cwy.googlegro ups.com...
In a book i'm reading i've just ventured into chapter 3 - C# language
fundamentals.
Now i can see that the first part of the code after the class
definition defines a public variable, of type string, called
userMessage. But I don't understand the term 'point of state data' can
someone clarify that for me please.

TIA. Gary-

I've just encountered the following sample code: -

// HelloClass, with constructors.
using System;
class HelloClass
{
// A point of state data.
public string userMessage;

// Default constructor.
public HelloClass()
{ Console.WriteLine("Default ctor called!"); }

// This custom constructor assigns state data
// to a user-supplied value.
public HelloClass (string msg)
{
Console.WriteLine("Custom ctor called!");
userMessage = msg;
}

// Program entry point.
public static int Main(string[] args)
{

// Call default constructor.
HelloClass c1 = new HelloClass();
Console.WriteLine("Value of userMessage: {0}\n", c1.userMessage);

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Testing, 1, 2, 3");
Console.WriteLine("Value of userMessage: {0}", c2.userMessage);
Console.ReadLine();
return 0;
}
}

Dec 20 '06 #3
Thankyou both very much, that clarified it for me.

Thankyou,

Gary-

Dec 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
100
by: E. Robert Tisdale | last post by:
What is an object? Where did this term come from? Does it have any relation to the objects in "object oriented programming"?
51
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is...
58
by: Larry David | last post by:
Ok, first of all, let's get the obvious stuff out of the way. I'm an idiot. So please indulge me for a moment. Consider it an act of "community service".... What does "64bit" mean to your friendly...
8
by: Midnight Java Junkie | last post by:
Dear Colleagues: I feel that the dumbest questions are those that are never asked. I have been given the opportunity to get into .NET. Our organization has a subscription with Microsoft that...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.