I have a class that has three private attributes:
empID, LastName, FirstName
I want to set the LastName and FirstName attributes based on a database query of the empID value that is set and don't want anything outside the class to be able to set the LastName and firstName attributes. But I want any calling code to be able to get the ID, LastName, or FirstName attributes. I was going to set these up as properties but I'm not sure how I would set up the properties such that the ID attribute could be set/read by any caller (public), but the LastName, FirstName values could only be retrieved. Again, the setting of the LastName and FirstName attributes would be set when the empID value is set...I am assuming through Set call to the empID property. Hopefully this makes sense. How would I set up something like this in my class?
empID, LastName, FirstName
I want to set the LastName and FirstName attributes based on a database query of the empID value that is set and don't want anything outside the class to be able to set the LastName and firstName attributes. But I want any calling code to be able to get the ID, LastName, or FirstName attributes. I was going to set these up as properties but I'm not sure how I would set up the properties such that the ID attribute could be set/read by any caller (public), but the LastName, FirstName values could only be retrieved. Again, the setting of the LastName and FirstName attributes would be set when the empID value is set...I am assuming through Set call to the empID property. Hopefully this makes sense. How would I set up something like this in my class?