© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
waler

Help with program logic

So I'm currently doing an exercise for OOP, where I'm designing a database for a classroom of students.
So basically I just have two objects "Student" and "Classroom" with specific behaviours like adding a student or removing a student, etc...
For context related to my question, the "Student" class has 5 attributes to it being:
- Student ID
- Student social security number
- Student's name
- Date of birth
- City of birth
Note: every parameters name in the screenshot is also mentioned in this order (ID is excluded)

The main thing I want to ask here is:
I'm trying to implement this new behaviour in the Student class where I can update a student's credentials (Student's ID can not be changed).
I know that sometimes, we only need to update a few information like their name and birthday or sometimes all of their credentials (except the ID)

At first, I thought I can declare all of the parameters and set a default value for them so any credentials that need not be updated can be left blank (as in not inputted when calling this method).
However, I then realise that it was not that simple since I have a case where I need to update the security number and birthdate, but not their name or birthplace. So calling the method as
student1.UpdateInfo("new security number", "new birthdate")
student1.UpdateInfo("new security number", "new birthdate")

would not work, since the
"new birthdate"
"new birthdate"
is understood as the input for the parameter
hoten_new
hoten_new


Another solution that I came up with this is to overload this method with all of the possible combinations, but then that would mean I need to have (2^4 - 1)
UpdateInfo
UpdateInfo
methods with different parameters.

I need some suggestions on what to do here in this case.
Code is not written in english so please excuse the inconvenience
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Please, help me with program logic
C#CC# / help
2y ago
Help with program structure.
C#CC# / help
3y ago
Need help with GIT logic
C#CC# / help
2y ago
Help with Simon game logic
C#CC# / help
3y ago