Michael Nyrup wrote in message <[EMAIL PROTECTED]>...
>
>Hi
>I´am sorry but I don´t quite understand this, I hope you would care to help
>me understand it, as I use objects in my code as often as possible.
>
>> Less common situation, but also possible: if object A is
>> used where object B required, and there is a constructor
>> for B that takes an A as a parameter, a B will be created
>> automagically.
>
>Will I automaticlly create an object of B if I create an object of class A
>in this eksample? It does´nt make sense to me.
>
>Sorry if you find this PalmOS off topic.
>
This illustrates it (not on the Palm...):
#include <stdlib.h>
#include <iostream.h>
class A {
public:
A() {
cout << "A::A()" << endl;
}
};
class B {
public:
B() {
cout << "B::B()" << endl;
}
B(const A &a) {
cout << "B::B(A&)" << endl;
}
};
void func(B b) {
cout << "func(b)" << endl;
}
int main(int argc, const char *argv[])
{
A a;
func(a);
return 0;
}
--
-Richard M. Hartman
[EMAIL PROTECTED]
186,000 mi/sec: not just a good idea, it's the LAW!
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/