1. Whether the compilation method copies the CSC and system files to the Web. After compilation
Delete them and call them on the ASPX page.
After writing a. BAT file, you also need to copy it to compile it successfully!
How did you compile it?
2. Why is my extendedprofile unable to construct its own function? It inherits the attributes of the profile.
In the test, we found that the profile function can be used, but its own function is actually effective, prompting
An object reference is required for the nonstatic field, method,
Or property 'heritance. extendedprofile. getaddress ()
3 profile. CS
Namespace inheritance
{
Using system;
Using system. text;
Public class Profile
{
Private string _ firstname;
Private string _ lastname;
Private string _ phonenumber;
Public Profile ()
{
_ Firstname = "yang ";
_ Lastname = "sy ";
_ Phonenumber = "1357382776 ";
}
Public void setphonenumber (string phonenumber)
{
_ Phonenumber = phonenumber;
}
Public String getphonenumber ()
{
Return _ phonenumber;
}
Public void setfirstname (string firstname)
{
_ Firstname = firstname;
}
Public String getfirstname ()
{
Return _ firstname;
}
Public void setlastname (string lastname)
{
_ Lastname = lastname;
}
Public String getlastname ()
{
Return _ lastname;
}
}
Public class extendedprofile: Profile
{
Private string _ address;
Private string _ city;
Private string _ state;
Public extendedprofile ()
{
_ Address = "Room G, 16/F, light ride building, No. 88 Xiangjiang Road, Qingdao Economic and Technological Development Zone ";
_ City = "Qingdao ";
_ State = "Shandong ";
}
Public void setaddress (string address)
{
_ Address = address;
}
Public String getaddress ()
{
Return _ address;
}
Public void setcity (string City)
{
_ City = city;
}
Public String getcity ()
{
Return _ city;
}
Public void setstate (string state)
{
_ State = State;
}
Public String getstate ()
{
Return _ state;
}
}
}
4 call extendedprofile
message. innerhtml + = "Address:" + extendedprofile. getaddress () + "
";
message. innerhtml + = "City:" + extendedprofile. getcity () + "
";
message. innerhtml + = "state:" + extendedprofile. getstate () + "
";