0

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?

2 Answers 2

2
Public Class Client
   ' code here...
End Class

Public Class Student
    Inherits Client
    ' code here...
End Class
Sign up to request clarification or add additional context in comments.

1 Comment

After posting this I think I wasn't as clear as I should be. Every student starts out as a Client and may later become a student, how do I 'promote' a client to a student. Since all students already have client information how do I add only the necessary student info to an existing client info without creating a new client object.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.