Jonathan Oberhaus

Jonathan Oberhaus

  • NA
  • 6
  • 10.8k

Method is used like a type

Nov 29 2012 2:15 PM
I have a derived class called Bourbon that I am making, however I keep getting an error on the line that I bolded that says the method is being used like a type?


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

namespace Test
{
    class Bourbon : Whiskey
    {
        Bourbon[] bBottles = new Bourbon[5];

        public Bourbon(string name, string distillery, int age)
        {
            Name = name;
            Distillery = distillery;
            Age = age;
        }

        public void PopulateBottles()
        {
            Console.WriteLine("Please enter the information for 5 bourbons:");
            for (int runs = 0; runs < 5; runs++)
            {
                Console.WriteLine("Name:");
                var name = Console.ReadLine();
                Console.WriteLine("Distillery:");
                var distillery = Console.ReadLine();
                Console.WriteLine("Age:");
                var age = int.Parse(Console.ReadLine());
                var bourbon = new Bourbon(name, distillery, age);
                bBottles[runs] = bourbon;
            }
        }

    }
}

Answers (1)