파일 목록
-
📁 10
-
📁 3
-
📁 4
-
📁 4-minicalc
-
📁 7
-
📁 parking manager
- 2.cs
- desktop.ini
- Title.png
- 객체지향 3대 특징(+1).txt
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Weeks12
{
internal class Animal
{
//자동 프로퍼티
public int Age
{
get;
set;
}
public void Eat()
{
Console.WriteLine("촵촵 먹습니다.");
}
//출력전용변수 out - 일종의 포인터 //TryParse가 이거 이용한거!
public bool NextAge(out int nextage) //out 쓰면 포인터처럼 동작함 but 반드시 값을 넣어야함 // C#두번째로 편리한 문법
{
if (Age <= 0) {
nextage = Age;
return false;
}
nextage = Age + 1;
return true;
}
}
}