Step 1
- look at the code
- open
trypoly.cpp - create a Pentagon, call its
perimetermethod - Compile via
make, execute via./trypoly- you may have to add current directory to your LD_LIBRARY_PATH :
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:.- create an Hexagon, call its
perimetermethod - recompile and check what happens
Step 2
- create an Hexagon, call its parent’s
perimetermethod - recompile and check again
- retry with virtual methods
- preprocess
Polygons.cpp(g++ -E -o output) - compile
Polygons.oandtrypoly.o(g++ -c -o output) - use
nmto check symbols in.ofiles - look at the
Makefile - try
make clean; make - see linking stage using
g++ -v- just add a
-vin the Makefile command fortrypoly - run
make clean; make - look at the collect 2 line, from the end up to
-o trypoly
- just add a
- see library dependencies of
trypolyandPolygons.sowithldd- On OS X, use
otool -Lfor a similar effect
- On OS X, use