Should I Use Interfaces or Inheritance for My App?

0
3
Asked By CuriousCoder23 On

I'm building a basic app to help users create family trees by asking for input and then saving that to a database. I'm not sure if I should make an input class for this in my main method or use an interface instead. I also have a PeopleManager class where I'm adding family members to the database, but I haven't connected to the database yet or created a dbhelper class. How should I organize my code? Any advice would be greatly appreciated! By the way, I'm a complete beginner.

1 Answer

Answered By CodeCrafter On

An interface is basically a 'contract' that ensures a class has certain functionalities, whereas inheritance lets you extend an existing class with added functionality. They complement each other but serve different purposes.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.