[geeks] C++ inner workings
Joshua D Boyd
geeks at sunhelp.org
Wed Nov 21 21:49:36 CST 2001
I'm trying to figure out the inner workings of C++. I'm wondering if any one
has any online documents they could point me to.
Specifically, I'm thinking about inheritance.
For instance:
class A {
virtual read();
}
class B : A {
read();
}
How does it know which read to call? I can think of some possible ways to
implement this functionality, but I want to know what actually occurs.
In case people think I'm just pretending I know ways to encourage people to
help me with homework, I'll give you one way.
Imagine:
typedef void (*FNC_TYPE)(void);
struct A {
FNC_TYPE read;
}
struct B {
FNC_TYPE read;
A a;
}
Then the initializer (possibly a macro if I was actually writing the above
code to fake inheritence in C) would set the read pointer to the proper read
function. At least, that is one thought on implementing this. Propably a
bad one though.
--
Joshua D. Boyd
More information about the geeks
mailing list