Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,557 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,931 people online right now. Registration is fast and FREE... Join Now!




accessing 1d array as 2d array

 
Reply to this topicStart new topic

accessing 1d array as 2d array

upant
11 Apr, 2008 - 08:57 AM
Post #1

D.I.C Head
**

Joined: 15 Feb, 2008
Posts: 84

I am trying to overload =operator and here is my function
CODE
const Array &Array::operator=( const Array &right)
{
    if( &right != this)
    {
        delete [] ptr;
        size = row*column;
        ptr = new int[ size];
    }
    for( int i = 0; i <size; i++)
    {
        ptr[i] = right.ptr[i];
    }

is this what u do for 2d array? I am trying to use this function for 2d array.....
row, column and size are my private variables.


Thanks,
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 11:25PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month