Kevin
Kevin

Reputation: 3

VB.Net: Class Inheritance make one class another

I have an organization that has clients and students, every student begins as a client. If I have a Client class and a student class that inherits from client. How do I make a client a student?

Upvotes: 0

Views: 444

Answers (2)

Vincent
Vincent

Reputation: 421

It sounds like your problem involves persistence more than inheritance. If you have a client, presumably the persistent data is stored in a client table. When this client becomes a student, you could create a record in a student table containing the student information and the id of the client record. A client object would be loaded from the client table, while a student object would pull data from both client and student tables. Relating the data means client info would never be duplicated, while making it simple to retrieve either client info, or student--including client--info.

Upvotes: 0

froadie
froadie

Reputation: 83063

Public Class Client
   ' code here...
End Class

Public Class Student
    Inherits Client
    ' code here...
End Class

Upvotes: 2

Related Questions