클래스와 구조체의 차이(2) - c# public class Person { public string Name { get; set; } public int Age { get; set; } public Person(string name, int age) { Name = name; Age = age; } //Other properties, methods, events... } class Program { static void Main() { Person person1 = new Person("Leopold", 6); Console.WriteLine("person1 Name = {0} Age = {1}", person1.Name, person1.Age); // Declare new person, assign person1 to it. Person.. 더보기 클래스와 구조체의 차이 - c# 클래스와 구조체의 구분은 C++를 사용할때 부터 약간의 논의가 있었다. 실제로 C++에서의 구분은 거의 없다고 봐야하며, 디폴트 접근자가 private이냐 public 정도의 차이였다. C# 에서의 msdn 가이드로 나온 부분을 보면 다음과 같다. Classes and structs are two of the basic constructs of the common type system in the .NET Framework. Each is essentially a data structure that encapsulates a set of data and behaviors that belong together as a logical unit. The data and behaviors are the memb.. 더보기 이전 1 ··· 66 67 68 69 다음