FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
September 01, 2005

C++/CLI: Cloning

(Page 8 of 11)

September, 2005: C++/CLI: Cloning

Listing 6

public ref class Base : ICloneable
{
     array<int>^ bPair ;
public:
     Base(int i, int j)
     {
          bPair = gcnew array<int>(2) {i, j};
     }
     void SetValue(int i, int j)
     {
          bPair[0] = i;
          bPair[1] = j;
     }
     virtual String^ ToString() override
     {
          return String::Concat("[", bPair[0], ":", bPair[1], "]");
     }
     virtual Object^ Clone() override
     {
          Base^ b = static_cast<Base^>(MemberwiseClone());
          b->bPair = static_cast<array<int>^>(bPair->Clone());
          return b;
     }
};

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK