j****i 发帖数: 305 | 1 I have the following classes: Atom, Molecule (contains atoms). I also have
the CoordinatedAtom class
which derives from Atom and contains position information. My
CoordinatedMolecule class should derive
from Molecule, but needs to contain CoordinatedAtom, instead of Atom. How
should I write the
CoordinatedMolecule class? I think this might be a common design problem.
What I'm thinking is that
whether I could define a member variable in CoordinatedMolecule that has the
same name as the base
class | D*******a 发帖数: 3688 | 2 use template
Molecule
Molecule
the
【在 j****i 的大作中提到】 : I have the following classes: Atom, Molecule (contains atoms). I also have : the CoordinatedAtom class : which derives from Atom and contains position information. My : CoordinatedMolecule class should derive : from Molecule, but needs to contain CoordinatedAtom, instead of Atom. How : should I write the : CoordinatedMolecule class? I think this might be a common design problem. : What I'm thinking is that : whether I could define a member variable in CoordinatedMolecule that has the : same name as the base
|
|