Creating a function that will handle objects with common properties

Posted by geocine on Stack Overflow See other posts from Stack Overflow or by geocine
Published on 2011-01-04T02:51:11Z Indexed on 2011/01/04 2:53 UTC
Read the original article Hit count: 221

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET