Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. class B1 {
  2. public:
  3.     int b1;
  4. };
  5.  
  6. class B2 {
  7. public:
  8.     int b2;
  9. };
  10.  
  11. class C:
  12.     virtual public B1,
  13.     public B2 {
  14. public:
  15.     int c;
  16. };
  17.  
  18. C obj;
  19.  
  20. MAIN
  21. {
  22.     int (B1::*pb1) = &B1::b1;
  23.     int (B2::*pb2) = &B2::b2;
  24.  
  25.     obj.b1 = 17;
  26.     obj.b2 = 18;
  27.  
  28.     int (C::*ip) = pb1;     // implicit conversion
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement