cs Oct 28
Oct 28
function overloading -operator overloading
f(2);
void f(int)
f()
void f()
compitle time binding -- early binding
run-time binding - late binding
Inheritance -- is-a
aggregation -- contains, has-a
ch12 - ch16
a point is a circle (could be with radius = 0)
a circle is a point (could be with radius )
a circle has a point
a point has a circle
compile-time binding -- static
runtime-binding -- dynamic
runtime binding
Shape *sh;
Triangle T;
Square S;
T.draw();
S.draw();
Sh = &T;
Sh->draw();
or a function
f(Shape & s)
{
s.draw()
}
inheritance hierarchy using pointers
using ponter to to the base object...
in C++ this is implemented using virtual functions.
add keyword virtual (for this to work the compiler must add code to make it happen)
virtual void draw(); // possibly runtime polymorphism
invoke the function using a pointer.
1. invoke the function using a pointer or reference to the object. sh->draw() or f(Shape& s)
2. virtual keyword.
Graphlib, javadoc
compile chapter.12.3.cpp
1. install fltk-1.1.10-dev.tcz to access fltk dependent tools/libraries especially fltk-config
- Build the author's library
-compile chapter.12.3.cpp
-tangram lab(1) development
4th parameter is default..
sudo find -name "simple_window.h"
sudo find / -name Fl.h
g++ -I ../GUI chapter.12.3.cpp -lbookgui -L../GUI -fno-rtti `fltk-config --ldflgs --use-images`
Libraries lib___.a
compile -l libraryname(ending with .a)
atoi : ascii to integer..
1 < atoi("1") <cstdlib>
/GUI directory ran make
editor GUI.cpp
added <cstdlib>
qualified atoi by std::atoi
fltk-config
fltk-config --compile program.cxx
fltk-config --libs
/usr/local/lib/libfltk.a
--ldflags
-lfltk
RTTI (Runtime type Instantiation)
cd
adding -fno-rtti in makefile of /GUI for CXXflags
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=fitting%20the%207%20tangram%20shapes%20into%20a%20square%20algorithm
Building the tangram square with the seven pieces.
function overloading -operator overloading
f(2);
void f(int)
f()
void f()
compitle time binding -- early binding
run-time binding - late binding
Inheritance -- is-a
aggregation -- contains, has-a
ch12 - ch16
a point is a circle (could be with radius = 0)
a circle is a point (could be with radius )
a circle has a point
a point has a circle
compile-time binding -- static
runtime-binding -- dynamic
runtime binding
Shape *sh;
Triangle T;
Square S;
T.draw();
S.draw();
Sh = &T;
Sh->draw();
or a function
f(Shape & s)
{
s.draw()
}
inheritance hierarchy using pointers
using ponter to to the base object...
in C++ this is implemented using virtual functions.
add keyword virtual (for this to work the compiler must add code to make it happen)
virtual void draw(); // possibly runtime polymorphism
invoke the function using a pointer.
1. invoke the function using a pointer or reference to the object. sh->draw() or f(Shape& s)
2. virtual keyword.
Graphlib, javadoc
compile chapter.12.3.cpp
1. install fltk-1.1.10-dev.tcz to access fltk dependent tools/libraries especially fltk-config
- Build the author's library
-compile chapter.12.3.cpp
-tangram lab(1) development
4th parameter is default..
sudo find -name "simple_window.h"
sudo find / -name Fl.h
g++ -I ../GUI chapter.12.3.cpp -lbookgui -L../GUI -fno-rtti `fltk-config --ldflgs --use-images`
Libraries lib___.a
compile -l libraryname(ending with .a)
atoi : ascii to integer..
1 < atoi("1") <cstdlib>
/GUI directory ran make
editor GUI.cpp
added <cstdlib>
qualified atoi by std::atoi
fltk-config
fltk-config --compile program.cxx
fltk-config --libs
/usr/local/lib/libfltk.a
--ldflags
-lfltk
RTTI (Runtime type Instantiation)
cd
adding -fno-rtti in makefile of /GUI for CXXflags
https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=fitting%20the%207%20tangram%20shapes%20into%20a%20square%20algorithm
Building the tangram square with the seven pieces.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home