3
Reply

c# error (does not exist in the current context)

Asim Poptani

Asim Poptani

Dec 17 2013 4:14 PM
29.1k
My code:

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)