I am building an application that allows you to apply styles to regular expressions and their capture groups. I have a class called RegexGroup which contains a list of RegexGroup‘s and Regex‘s.
I will make a gui front-end in order to utilize these classes and I started by making a Project class that will be serializable but I realized that a Project class would be exactly the same as the RegexGroup. Is it good or bad practice to create a Project class that is exactly the same as another just because they will be used in different contexts? Or should I just stick with using the RegexGroup class?
Thanks in advance, ell.
note: I had trouble thinking of a title, please correct me if the use of the word “semantics” is incorrect
note: I am currently writing this in java but would this be an appropriate use of typedef in c++?
Edit: The classes are literally exactly the same. Their implementation and interface is completely identical, there are no differences whatsoever.
If a Project is actually a RegexGroup . Then you could just derive from it.
It makes perfect sense, if you say something is another, then that’s where you derive from it.
And of course, along the way you might find subtle differences where you could add stuff to the separate classes, or even create a base class for both.
And yes, in c++ you could just use
typedefto declare another alias to the same type.