Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9749701
property.cs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
908 B
Subscribers
None
property.cs
View Options
// property.cs
// Properties
using
System
;
public
class
Employee
{
public
static
int
numberOfEmployees
;
private
static
int
counter
;
private
string
name
;
// A read-write instance property:
public
string
Name
{
get
{
return
name
;
}
set
{
name
=
value
;
}
}
// A read-only static property:
public
static
int
Counter
{
get
{
return
counter
;
}
}
// Constructor:
public
Employee
()
{
// Calculate the employee's number:
counter
=
++
counter
+
numberOfEmployees
;
}
}
public
class
MainClass
{
public
static
void
Main
()
{
Employee
.
numberOfEmployees
=
100
;
Employee
e1
=
new
Employee
();
e1
.
Name
=
"Claude Vige"
;
Console
.
WriteLine
(
"Employee number: {0}"
,
Employee
.
Counter
);
Console
.
WriteLine
(
"Employee name: {0}"
,
e1
.
Name
);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 25, 6:07 PM (14 h, 13 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3465509
Attached To
rPUC universal-ctags debian packaging
Event Timeline
Log In to Comment