C#C
C#3y ago
Phonem

✅ classes giving me an error for no reason

namespace Phonem
{
    class Program
    {
        static void Main(string[] args)
        {  
            Book book1 = new Book();
            book1.title = "phonem book";
            book1.author = "Phonem";
            book1.pages = 400;
            Console.WriteLine(book1.title.Length);
        }
    }
}

namespace Phonem
{
    class Book
    {
        public string author;
        public string title;
        public int pages;
    }
}

i made this little code using a tutorial im watching, everything was the same except i wanted to try using "book1.title.Length); method. but for some reason its giving me an error which is on the file.
please help. thanks
image.png
Was this page helpful?