Aggregation or inheritance?

A

AMB

Hi,

Over the summer im going to building a few graphical programs to test out
some curve mathematics I've been taught this year. To do it im going to
build a rudimentary graphics lib to speed up some later examples I'll doing.

But I was wonder if anyone here has any thoughts on which would be
preferable to use in the design of some the objects I'll need such as 3d
points and curve segments.

Would it be better to use aggregate objects or to use inheritance to build
up the class objects I'll need.

Also I apologise if this is in the wrong mailing list, but since I'll being
c++ I thought I'd try here before a specialist graphics mailing list.

Thanks for any help

Andy
 
V

Victor Bazarov

AMB said:
Over the summer im going to building a few graphical programs to test out
some curve mathematics I've been taught this year. To do it im going to
build a rudimentary graphics lib to speed up some later examples I'll
doing.

Take my advice, don't. Find and download a free library that would do
what you need. Spend a day searching, it's less expensive than spending
a month coding your own graphics lib.
But I was wonder if anyone here has any thoughts on which would be
preferable to use in the design of some the objects I'll need such as 3d
points and curve segments.

Why don't you ask in comp.graphics.algorithms?
Would it be better to use aggregate objects or to use inheritance to build
up the class objects I'll need.

It's entirely up to you. This newsgroup is not really the right place
to ask. Try comp.object, but you still need to explain what kind of
problem you're going to be modelling.
Also I apologise if this is in the wrong mailing list, but since I'll being
c++ I thought I'd try here before a specialist graphics mailing list.

Once again, take my advice, don't waste time implementing a graphics
library if all you need it for is to test some curve algorithms and/or
math you learned. Get an open source library and extend it.

Victor
 
S

Steven T. Hatton

AMB said:
Hi,

Over the summer im going to building a few graphical programs to test out
some curve mathematics I've been taught this year. To do it im going to
build a rudimentary graphics lib to speed up some later examples I'll
doing.

Are you sure you are ready for that level of programming? You'll probably be
better served to use something like OpenGL, or any number of graphics
toolkits.
But I was wonder if anyone here has any thoughts on which would be
preferable to use in the design of some the objects I'll need such as 3d
points and curve segments.
Would it be better to use aggregate objects or to use inheritance to build
up the class objects I'll need.
It really depends if you are able to abstract some commonality from the
representations of the different objects you are modeling. If you can,
then you use inheritance. If not. structs and arrays will probably
suffice. Geometric objects are one of the most common sources of examples
used to introduce object oriented programming, so it is very likely there
will be an opportunity to use inheritance.
Also I apologise if this is in the wrong mailing list, but since I'll
being c++ I thought I'd try here before a specialist graphics mailing
list.

It depends on the questions you have. If they are related to C++ and how to
use the language, then this is a resonably good place to post. There is a
FAQ for the newsgroup You can find it and more if you use google to search
the newsgroup for "Welcome to comp.lang.c++! Read this first."
 
J

jeffc

AMB said:
Also I apologise if this is in the wrong mailing list, but since I'll being
c++ I thought I'd try here before a specialist graphics mailing list.

This isn't a mailing list by the way, in case you haven't already noticed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top