3
Answers

The name does not exist in the current context (Error)

Here is my code where I'm getting error, The name does not exist in the current context.
 
Person.cs no errors:


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


namespace Firstpro.People
{
    public class Person
    {
        public string Firstname
        {
            get;
            private set;
        }
        public string Lastname
        {
            get;
            private set;
        }


        public Person(string firstname, string lastname)
        {
            Firstname = firstname;
            Lastname = lastname;
        }
        public string RetrieveData (Person person)
        {
            StringBuilder bulid = new StringBuilder();
            bulid.Append(Firstname +" "+ Lastname);
            return  bulid.ToString();
        }
    }
}


Customer.cs (error saying Error1The name 'firstname' does not exist in the current context):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Firstpro.People
{
    public class customer : Person
    {
        public customer(string username, string lastname = "") : base(firstname, lastname) 
        {
            Console.WriteLine(username);
        }
    }
}




Answers (3)