J
John
Hi there,
I am writing a simple program that will connect to database.
Database has 2 tables, let's call them father and child.
This is one to many relationship.
I would like to create corresponding classes for each table.
Each class would have functions Insert, Edit, Delete
I would like to find some information how to properly design my classes.
I used to program in php and delphi.
So I used to create separe class that corresponded to each table in
database.
In Father class I used to crate an array of child.
whenever Father was inserting new record to database, it was also inserting
corresponding record(s) into child.
I can easly do it, but would like to find out what is the best way to do it.
For instance, if there are 2 tables in database (father and child)
Father has
Id Integer
FatherName String
Child has
Id Integer (corresponds to father Id)
ChildName String
How to design 2 classes fot both tables?
Thanks,
John
I am writing a simple program that will connect to database.
Database has 2 tables, let's call them father and child.
This is one to many relationship.
I would like to create corresponding classes for each table.
Each class would have functions Insert, Edit, Delete
I would like to find some information how to properly design my classes.
I used to program in php and delphi.
So I used to create separe class that corresponded to each table in
database.
In Father class I used to crate an array of child.
whenever Father was inserting new record to database, it was also inserting
corresponding record(s) into child.
I can easly do it, but would like to find out what is the best way to do it.
For instance, if there are 2 tables in database (father and child)
Father has
Id Integer
FatherName String
Child has
Id Integer (corresponds to father Id)
ChildName String
How to design 2 classes fot both tables?
Thanks,
John