Thanks, so in my simple words - instead of using multiple inheritance in downstream fashion doing it this way is sort of in reverse - the printer class goes first.
Your are very helpful and much appreciated.
Yes we are putting composition over inheritance, so our classes are trying to achieve multiple
and flexible behaviour (reusing as much code as possible) rather than inheritance from a base
or parent class.
I would also add there is one final thing you will be able to do if you go that path which you
can't possibly do with your current scheme, which is to thread the classes or at least the one
that had the old ISR code to help its response and speed.
Using const that way in the declaration of the method tells the compiler that the method is able to be called on constant instances of that object. It indicates that the object is not altered in any way by calling that method. Examples using the class defined above:
const Point2d p1(2,3);
p1.setCoords(3,2); // Compiler error. setCoords not declared as const method
p2.setCoords(5,4); // OK
double n = p1.norm(); // OK - norm declared as const method
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
It was working this morning, because I read the content to see that it answered the question. Most likely a problem at Microsoft's end; keep trying. Or just use Google to find an alternate page.CodeProject bug, link now fixed.
C++ has very specific way / syntax to instantiate a class with parameters,
so basic that Google can't find it for me .
I need this for implementing multiple inheritance.
I can instantiate the "top class" in multiple inheritance hierarchy , but it uses system generated default constructors, without parameters of course.
My goal is to create an instance of the top class with parameters passed to the hierarchy lower chain classes.
Do I make sense? I hope so.
A( int p ) : a( p )
B( int q ) : b( q )
class C : public A, B
C( int x, int y, int z ) : A( x ), B( y), c( z )
a = x; // also possible
int _tmain(int argc, _TCHAR* argv)
C test( 1, 2, 3 );
Will this help?
Last Visit: 31-Dec-99 18:00 Last Update: 23-Sep-21 18:16