Example #1
0
        static void Main(String[] args)
        {
            Sub2 s2 = new Sub2();

            Sub s1 = new Sub();

            Console.WriteLine(typeof(Sub2) == s1.GetType());
        }
Example #2
0
        static void Main(String[] args)
        {
            Console.WriteLine("整数を入力してください");

            int num = int.Parse(Console.ReadLine());

            Sub2 s2 = new Sub2(num);
        }
Example #3
0
        static void Main(String[] args)
        {
            Sub s1 = new Sub();

            s1.Test();

            Sub s2 = new Sub2();

            s2.Test();
        }
Example #4
0
        static void Main(String[] args)
        {
            Sub2 s2 = new Sub2();

            Console.WriteLine("年齢を入力してください");

            int ansAge = int.Parse(Console.ReadLine());

            s2.setAge(ansAge);

            int age = s2.Age;

            Console.WriteLine("あなたの年齢は" + age + "です");
        }
Example #5
0
        static void Main(String[] args)
        {
            Console.WriteLine("名前と年齢を答えてください");

            String ansName = Console.ReadLine();

            int ansAge = int.Parse(Console.ReadLine());

            Sub2 s2 = new Sub2(ansName, ansAge);

            String name = s2.Name;

            int age = s2.Age;

            Console.WriteLine("名前は" + name + "年齢は" + age);
        }
Example #6
0
        static void Main(String[] args)
        {
            Sub2 s2 = new Sub2();

            Console.WriteLine("名前、年齢を入力してください");

            String ansName = Console.ReadLine();
            int    ansAge  = int.Parse(Console.ReadLine());

            s2.Name = ansName;

            s2.Age = ansAge;

            int    age  = s2.Age;
            String name = s2.Name;

            Console.WriteLine("あなたの名前は" + name + "あなたの年齢は" + age);
        }