반응형
using System; // 정적
class Point
{
public Point()
{
nlnstance++;
// Console.WriteLine("{0}",Point.nlnstance); //static변수값누적
Console.WriteLine("{0}",this.nlnstance); // 인스턴스변수누적안됨
}
// public static int nlnstance =0; // static 를 없해고 함
public int nlnstance = 0;
}
class Class1
{
static void Main()
{
// Console.WriteLine("{0}",Point.nlnstance); // 정적인것
Point obj1= new Point();
Point obj2= new Point();
Point obj3 =new Point();
}
}
'.NET > C# Basic' 카테고리의 다른 글
C# 사용 개념 대충 순서 대충보는거 대충 (0) | 2008.10.10 |
---|---|
C# 정정맴버 (0) | 2008.10.10 |
클래스 관련 예제 (0) | 2008.10.10 |
상봉이 문제 (0) | 2008.10.09 |
소스 예제 (0) | 2008.10.07 |
C# 메서드 (0) | 2008.10.07 |
C# 배열 연산자 제어문 foreach (0) | 2008.10.06 |
c# ppt 4장 (0) | 2008.10.02 |