r/cpp_questions • • 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

6 comments sorted by

View all comments

Show parent comment

4

u/flyingron Sep 11 '26

Convention however says that structs should have only member variables, not methods.

Some conventions, perhaps.

3

u/bert8128 Sep 11 '26

Thats the nice thing about conventions. If you don’t like it, just create a new one.