Creating a function that will handle objects with common properties
- by geocine
Take this as an example
I have trimmed this example for readability and you may not find the use of this concept here.
class Teacher()
{
public Name {get; set;}
public Salt {get; set;}
public Department{get; set;}
}
class Student()
{
public Name {get; set;}
public Salt {get; set;}
public Section{get; set;}
}
public string GetEncryptedName(object Person)
{
//return encrypted name based on Name and Salt property
return encrypt(object.Salt,object.Name)
}
callig the function
GetEncryptedName(Teacher)
GetEncryptedName(Student)
How do you implement this kind of stuff?