i am having little trouble with class and object.i have this code and i just incementing the address of its object but no matter how many times i increment it is still able to access the member function .please help me i dont get this what i think is it is not suppose to happen?
#include<iostream>
using namespace std;
class B
{
int a,d,b,c;
public:
 void cl()
   {
     int f,m,b;
    cout<<"\nvoid cl";
   }
} obj;
int main()
{  B *m;
  int *i;
  m=&obj;
  cout<<"\nsize of obj="<<sizeof(obj);
  cout<<"\naddress of obj "<<&obj;
  cout<<"\nvalue of m="<<m;
  i=new int;
 // for(int j=0;j<10;j++)
  cout<<"\n value of i "<<*i;
  for(int j=0;j<10;j++)
{ m++;
  cout<<"\nvalue of m++ "<<m++;
  m->cl();
} cout<<"\n";
}
and the output is
nik-pc@nik:~/Documents$ ./a.out 
size of obj=16
address of obj 0x6013e0
value of m=0x6013e0
 value of i 0
value of m++ 0x6013f0
void cl
value of m++ 0x601410
void cl
value of m++ 0x601430
void cl
value of m++ 0x601450
void cl
value of m++ 0x601470
void cl
value of m++ 0x601490
void cl
value of m++ 0x6014b0
void cl
value of m++ 0x6014d0
void cl
value of m++ 0x6014f0
void cl
value of m++ 0x601510
void cl
nik-pc@nik:
 
    