Referring to a base class in a derived class
From: Webster (noone_at_nowhere.net)
Date: 01/31/04
- Next message: Andrey Tarasevich: "Re: C legacy coding style?"
- Previous message: Jonathan Turkanis: "Re: The Best C++ Compiler"
- Next in thread: Janusz Szpilewski: "Re: Referring to a base class in a derived class"
- Reply: Janusz Szpilewski: "Re: Referring to a base class in a derived class"
- Reply: lilburne: "Re: Referring to a base class in a derived class"
- Reply: Andrey Tarasevich: "Re: Referring to a base class in a derived class"
- Reply: Rolf Magnus: "Re: Referring to a base class in a derived class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 31 Jan 2004 01:01:17 GMT
Hello,
I have a class Shape and subclasses Circle, Rectangle etc. I also have a
function to write them to a file given a filepointer. However, I store the
colour info in the Shape class. My question is, is it possible to create a
WriteColour function in the Shape class, but when I call the sub class
writes (i.e. Circle.Write(...)), it will call the Shape's WriteColour
function??
Or is there a way to refer to the base class in a derived class to call it??
i.e.
base->function();
Thanks for any help!
-- Regards, Webster
- Next message: Andrey Tarasevich: "Re: C legacy coding style?"
- Previous message: Jonathan Turkanis: "Re: The Best C++ Compiler"
- Next in thread: Janusz Szpilewski: "Re: Referring to a base class in a derived class"
- Reply: Janusz Szpilewski: "Re: Referring to a base class in a derived class"
- Reply: lilburne: "Re: Referring to a base class in a derived class"
- Reply: Andrey Tarasevich: "Re: Referring to a base class in a derived class"
- Reply: Rolf Magnus: "Re: Referring to a base class in a derived class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]