keffer@SPERM.OCEAN.WASHINGTON.EDU (Tom Keffer) (08/01/89)
It was my impression that under C++, the cast notations A(B) and (A)B
are equivalent when casting a B as an A. This is not always true
under g++ 1.35.0. Here is a code strip that illustrates the
difference:
class A {
};
class B {
public:
operator A();
};
void foo(A&);
main()
{
B b;
foo( A(b) ); // Error: type `A' does not have a constructor
foo( (A)b ); // OK
}
-tk
---
Dr. Thomas Keffer | Internet: keffer@sperm.ocean.washington.edu
School of Oceanography | BITNET: keffer%sperm.ocean.washington.edu@UWAVM
Univ. of Washington, WB-10 | uucp: uw-beaver!sperm.ocean.washington.edu!keffer
Seattle, WA 98195 | Telemail: T.KEFFER/OMNET
(206) 543-6455