zoukankan
html css js c++ java
关于静态成员
using
System;
using
System.Collections.Generic;
using
System.Text;
namespace
ConsoleApplication9
{
class
Program
{
static
void
Main(
string
[] args)
{
employee a
=
new
employee();
employee b
=
new
employee();
employee c
=
new
employee();
employee.ShowConut();
}
class
employee
{
public
static
int
conut;
public
employee()
:
this
(
"
li
"
,
"
1
"
)
{
}
public
employee(
string
n,
string
I)
{
Name
=
n;
ID1
=
I;
conut
+=
1
;
}
string
name;
public
string
Name
{
get
{
return
name; }
set
{ name
=
value; }
}
string
ID;
public
string
ID1
{
get
{
return
ID; }
set
{ ID
=
value; }
}
public
void
showname()
{
Console.WriteLine(
this
.name);
}
public
static
void
ShowConut()
{
Console.WriteLine(conut);
}
}
}
}
类中的静态字段或方法只能在程序运行期间实例化一次,上例结果是3
肩负责任,永不退缩
查看全文
相关阅读:
UVALive
训练指南 UVA
训练指南 UVALive
Codeforces Round #535 (Div. 3)
训练指南 UVALive
训练指南 UVALive
Codeforces Round #534 (Div. 2)
Codeforces Round #532 (Div. 2)
《算法问题实战策略》——chaper9——动态规划法技巧
《训练指南》——8.3
原文地址:https://www.cnblogs.com/ATP/p/860631.html
最新文章
事件对象的兼容写法
call与apply
模拟jq的设置样式
dom 节点篇 ---单体模式
dom 节点篇---模块
dom 节点篇
关于全局变量,局部变量的几种方式
字符串 中的split 与数组中的join
网页上获取的元素值,为什么类型,string
[Fw]How to Add a System Call(Fedora Core 6 Kernel : 2.6.18)
热门文章
[轉]Linux 2.6内核笔记【内存管理】
[轉]关于CR0.WP
[轉]Reverse a singly linked list
Machine code transfer into assembly code
uint8_t / uint16_t / uint32_t /uint64_t 是什么数据类型
php被遗忘的参数 pcntl
selinux与kernel 0day
CVE-2010-4258漏洞分析
Codeforces Round 536 (Div. 2) (E)
训练指南 UVALive
Copyright © 2011-2022 走看看