473,806 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.WriteLi ne("Default ctor called!"); }

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

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

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

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Tes ting, 1, 2, 3");
Console.WriteLi ne("Value of userMessage: {0}", c2.userMessage) ;
Console.ReadLin e();
return 0;
}
}

Dec 20 '06 #1
3 1843
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********@myw ay.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.WriteLi ne("Default ctor called!"); }

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

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

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

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Tes ting, 1, 2, 3");
Console.WriteLi ne("Value of userMessage: {0}", c2.userMessage) ;
Console.ReadLin e();
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 "userMessag e"
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********@myw ay.comwrote in message
news:11******** **************@ 80g2000cwy.goog legroups.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.WriteLi ne("Default ctor called!"); }

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

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

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

// Call parameterized constructor.
HelloClass c2;
c2 = new HelloClass("Tes ting, 1, 2, 3");
Console.WriteLi ne("Value of userMessage: {0}", c2.userMessage) ;
Console.ReadLin e();
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
14874
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 software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
12
3308
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. Such things happen. The whole subsystem is going through radical changes. I don't really want to say what I think of the code just yet. That would influence the opinions of others, and I really want to know how other people view these things,...
121
10200
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 support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
100
5312
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
4574
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 there something wrong in there? -------------------------------------------------------------------- Types A type is a definition for a sequence of storage bits. It gives the meaning of the data stored in memory. If we say that the object a is an
58
30260
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 neighborhood C# programmer? The standard answer I get from computer sales people is: "It means that the CPU can process 64 bits of data at a time instead of 32." Ok... I guess I *kind* of understand what that means at an intuitive level, but what...
8
3193
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 basically entitled to us to just about every .Net development tool you can imagine. I cant even begin to mention them. To begin with, my background is not that of a programmer, but a systems engineer and the closest I have come to "programming"...
669
26274
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 paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
167
8378
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 object should run in its own thread, it should implement this mix-in class. Does this sound like plausible design decision? I'm surprised that C++ doesn't have such functionality, say in its STL. This absence of a thread/object relationship in...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10369
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.