C 언어
속성 클래스, 구조 및 인터페이스의 명명된 멤버입니다. 클래스 또는 구조의 멤버 변수 또는 메서드를 필드라고 합니다. . 속성은 필드의 확장이며 동일한 구문을 사용하여 액세스됩니다. 접근자를 사용합니다. 이를 통해 개인 필드의 값을 읽거나 쓰거나 조작할 수 있습니다.
속성은 저장 위치의 이름을 지정하지 않습니다. 대신 접근자가 있습니다. 값을 읽거나 쓰거나 계산합니다.
예를 들어 나이, 이름 및 코드에 대한 개인 필드가 있는 학생이라는 클래스가 있다고 가정해 보겠습니다. 클래스 범위 외부에서 이러한 필드에 직접 액세스할 수는 없지만 이러한 개인 필드에 액세스하기 위한 속성을 가질 수는 있습니다.
접근자 의 속성에는 속성을 가져오거나(읽거나 계산하거나) 설정(쓰기)하는 데 도움이 되는 실행 가능한 문이 포함되어 있습니다. 접근자 선언은 get 접근자, set 접근자 또는 둘 다를 포함할 수 있습니다. 예를 들어 -
// Declare a Code property of type string: public string Code { get { return code; } set { code = value; } } // Declare a Name property of type string: public string Name { get { return name; } set { name = value; } } // Declare a Age property of type int: public int Age { get { return age; } set { age = value; } }
다음 예는 속성의 사용을 보여줍니다 -
라이브 데모using System; namespace tutorialspoint { class Student { private string code = "N.A"; private string name = "not known"; private int age = 0; // Declare a Code property of type string: public string Code { get { return code; } set { code = value; } } // Declare a Name property of type string: public string Name { get { return name; } set { name = value; } } // Declare a Age property of type int: public int Age { get { return age; } set { age = value; } } public override string ToString() { return "Code = " + Code +", Name = " + Name + ", Age = " + Age; } } class ExampleDemo { public static void Main() { // Create a new Student object: Student s = new Student(); // Setting code, name and the age of the student s.Code = "001"; s.Name = "Zara"; s.Age = 9; Console.WriteLine("Student Info: {0}", s); //let us increase age s.Age += 1; Console.WriteLine("Student Info: {0}", s); Console.ReadKey(); } } }
위의 코드를 컴파일하고 실행하면 다음과 같은 결과가 생성됩니다. -
Student Info: Code = 001, Name = Zara, Age = 9 Student Info: Code = 001, Name = Zara, Age = 10
추상 클래스에는 파생 클래스에서 구현되어야 하는 추상 속성이 있을 수 있습니다. 다음 프로그램은 이것을 보여줍니다 -
라이브 데모using System; namespace tutorialspoint { public abstract class Person { public abstract string Name { get; set; } public abstract int Age { get; set; } } class Student : Person { private string code = "N.A"; private string name = "N.A"; private int age = 0; // Declare a Code property of type string: public string Code { get { return code; } set { code = value; } } // Declare a Name property of type string: public override string Name { get { return name; } set { name = value; } } // Declare a Age property of type int: public override int Age { get { return age; } set { age = value; } } public override string ToString() { return "Code = " + Code +", Name = " + Name + ", Age = " + Age; } } class ExampleDemo { public static void Main() { // Create a new Student object: Student s = new Student(); // Setting code, name and the age of the student s.Code = "001"; s.Name = "Zara"; s.Age = 9; Console.WriteLine("Student Info:- {0}", s); //let us increase age s.Age += 1; Console.WriteLine("Student Info:- {0}", s); Console.ReadKey(); } } }
위의 코드를 컴파일하고 실행하면 다음과 같은 결과가 생성됩니다. -
Student Info: Code = 001, Name = Zara, Age = 9 Student Info: Code = 001, Name = Zara, Age = 10
C 언어
1958년에 처음 발명된 탄소 섬유는 현대 세계에 큰 영향을 미쳤습니다. 탄소 섬유는 만들어진 이후로 스포츠 장비에서 우주선에 이르기까지 모든 것에 사용되었습니다. 이유를 찾는 것도 어렵지 않습니다. 탄소 섬유의 특성은 이러한 용도에 적합합니다. 그러나 우리는 어떤 속성에 대해 이야기하고 있습니까? 탄소 섬유를 유용한 재료로 만드는 이유는 무엇입니까? 이 기사에서 이에 대해 논의하겠습니다. 1. 힘 대 무게 유용하고 고품질의 재료를 만드는 것은 많은 현대 비즈니스의 기반입니다. 제조의 목표는 가능한 한 적게 희생하면서 가능한
유리 섬유 천 또는 직물은 다양한 공정으로 직조하여 유리 섬유 실로 만들어집니다. 내화, 단열 및 산업 단열에 이상적인 소재이며 다음과 같은 특성을 가진 복합 소재의 기본 원단입니다. 1. 내화학성 유리 자체와 마찬가지로 유리 섬유 천은 썩거나 곰팡이가 생기거나 변질되지 않습니다. 대부분의 화학 물질에 대한 저항성이 높습니다.2. 치수 안정성 유리 섬유 천은 늘어나거나 줄어들지 않습니다. 공칭 연신율 파단은 3-4%입니다. 파단 시 E 유리의 최대 연신율은 4.8%이며 파열 지점 근처에서 응력을 가할 때 100% 탄성 회복을 나