#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class Basic
{
public:
int a;
public:
virtual void test(int b)
{
a=b;
}
};
class son:public Basic
{
public:
void display()
{
cout<<a<<endl;
}
public:
int a;
};
int _tmain(int argc, _TCHAR* argv[])
{
son example;
cout<<example.a<<endl;
example.display();
example.test(4);
example.display();
return 0;
}
******************************************************************
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class Basic
{
public:
int a;
public:
virtual void test(int b)
{
a=b;
}
};
class son:public Basic
{
public:
void display()
{
cout<<a<<endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
son example;
cout<<example.a<<endl;
example.display();
example.test(4);
example.display();
return 0;
}
**********************Assert breakpoint******************************
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class Basic
{
public:
int a;
public:
void test(int b)
{
a=b;
}
};
class son:public Basic
{
public:
void display()
{
cout<<a<<endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
son example;
cout<<example.a<<endl;
example.display();
example.test(4);
example.display();
return 0;
}
**************************************************************
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
class Basic
{
public:
int a;
public:
void test(int b)
{
a=b;
}
};
class son:public virtual Basic
{
public:
void display()
{
cout<<a<<endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
son example;
cout<<example.a<<endl;
example.display();
example.test(4);
example.display();
return 0;
}