Classes are designed mostly based on a concept and its related data and operations.
Considering the implementation of an Office, we can think of the following objects.
- Office
- Department
- Employee
While implementing an office class we can think of the following data and operations
- Data
- Name
- Location
- Contact Details etc
- Operations
- PrepareSalary
Sample Code
public class Office
{
public string Name { get; set; }
public string Location { get; set; }
public string Phone { get; set; }
public void PrepareSalary()
{
// Do salary calculations here
}
}
No comments:
Post a Comment