next up previous
Next: How do I redefined Up: class and struct Previous: How do I read

How do I specify a copy constructor for a class whose code is not accessible?

Use the keyword operator.

// suppose class A's code is not accessible
A::A(const int i) { /* ... */ }

// This does not prevent you to make a B to A convertor

struct B
{
  int	b;
  B(const int i): b(i) {}
  operator A() { return A(b); }
};



Alexis Angelidis (PhD) 2005-01-11