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
肩负责任,永不退缩
查看全文
相关阅读:
LOJ-10096(强连通+bfs)
LOJ-10095(缩点的特殊使用)
LOJ-10094(强连通分量)
LOJ-10092(最大半连通子图)
【BZOJ3489】A simple rmq problem(KD-Tree)
UVA10384 推门游戏 The Wall Pushers(IDA*)
[SCOI2005]骑士精神(IDA*)
浅谈A*算法
【模板】K-D Tree
【XSY1953】【BZOJ4012】【HNOI2015】开店(动态点分治)
原文地址:https://www.cnblogs.com/ATP/p/860631.html
最新文章
vector 用法简介
二项式定理的证明
[NOI1995]石子合并 题解
背包问题
BZOJ2938 [Poi2000]病毒
[NOI Online #2 提高组] 涂色游戏
P1272 重建道路
P1429 平面最近点对(加强版)
AC自动机
拉格朗日插值法
热门文章
悬线法
线段树
tulun
玄武密码
8.14多校总结
第一次天梯赛模拟训练总结
杭师大校赛总结
LOJ-10109(欧拉回路)
LOJ-10104(割点+dfs)
LOJ-10097(2-sat问题)
Copyright © 2011-2022 走看看