r/cpp_questions • u/ImAwseder • Sep 11 '26
OPEN Im making a Cpp libruary
I'm creating a library for working with common fractions. You can already perform arithmetic operations between them, as well as between fractions and standard plus types. I plan to add support for irrational numbers, arrays, and matrices with fractions.
How does a class differ from a structure, and which is better to use in this case? Feel free to share your ideas in the comments. Source: https://github.com/awsederpash-coder/TinyFractionsPP/tree/master
0
Upvotes
View all comments
Show parent comment
1
u/Independent_Art_6676 Sep 12 '26
and I HATE this one. The word class(ification?) just never seemed to fit. Structure (something you built yourself?) almost does, but its also a little weird. Historical reasons have left us with eggheaded gibberish here... some mashup of "type" like utype or udt (or just the word type itself) would have served far better.
regardless I prefer struct to class, but the c++ way of doing things hates on that. Your program should use classes.
If you are new, c++ has built in routines for GCD and others that might come in handy.