Asim Poptani

Asim Poptani

  • NA
  • 3
  • 68.4k

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

Dec 17 2013 4:14 PM
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)