A question of IS-A and proper inheritance (this could be a troll... ;-) )
From: Alf P. Steinbach (alfps_at_start.no)
Date: 03/14/04
- Next message: Ralf: "Re: Messages queue, Linux, memory usage"
- Previous message: Charles Richmond: "Re: A "valid" Bubble sort algorithm?"
- Next in thread: Claudio Puviani: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Reply: Claudio Puviani: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Reply: Cy Edmunds: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Mar 2004 09:01:57 GMT
I recently just typed in, in a hurry,
class ColorSpec
{
public:
typedef unsigned char Byte;
private:
Byte myRed, myGreen, myBlue, myAlpha;
public:
ColorSpec( Byte r, Byte g, Byte b, Byte a = 0 )
: myRed( r ), myGreen( g ), myBlue( b ), myAlpha( a )
{}
Byte r() const { return myRed; }
Byte g() const { return myGreen; }
Byte b() const { return myBlue; }
Byte a() const { return myAlpha; }
}; // class ColorSpec
class OpaqueColorSpec: public ColorSpec
{
public:
OpaqueColorSpec( Byte r, Byte g, Byte b )
: ColorSpec( r, g, b, 0 )
{}
}; // class OpaqueColorSpec
In fact I think this is what I'd ended up with also if I'd invested
time to think about it.
But what do you folks think?
-- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
- Next message: Ralf: "Re: Messages queue, Linux, memory usage"
- Previous message: Charles Richmond: "Re: A "valid" Bubble sort algorithm?"
- Next in thread: Claudio Puviani: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Reply: Claudio Puviani: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Reply: Cy Edmunds: "Re: A question of IS-A and proper inheritance (this could be a troll... ;-) )"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|