아카이브

과일 클래스 본문

C#프로그래밍

과일 클래스

timbercat 2023. 7. 21. 16:38

사과

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearnDotnet
{
    internal class Apple
    {
        string name;
        public Apple(string name)
        {
            Console.WriteLine("{0}가 생성되었습니다.",name);
        }
    }
}

 

바나나

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearnDotnet
{
    internal class Banana
    {
        string name;
        public Banana(string name) 
        {
            Console.WriteLine("{0}가 생성되었습니다.",name);
        }
    }

 

키위

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearnDotnet
{
    internal class kiwi
    {
        string name;
        public kiwi(string name)
        {
            Console.WriteLine("{0}가 생성되었습니다.", name);
        }
    }
}

 

App

using System;
using System.Collections.Generic;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;

namespace LearnDotnet
{
    internal class App
    {
        //생성자 
        public App()
        {
           new Apple("청사과");
           new Apple("정선사과");
           new Banana("델몬트 바나나");
           new Banana("돌 바나나");
           new Apple("썬골드키위");
           new Apple("그린키위");
        }
    }
}

'C#프로그래밍' 카테고리의 다른 글

마린 저글링 메딕  (0) 2023.07.24
영웅 클래스  (1) 2023.07.21
스타크래프트 SCV  (0) 2023.07.21
for 반복문  (0) 2023.07.20
스타크래프트 enum  (0) 2023.07.20