المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Data Encapsulation



C++ Programming
06-09-2012, 01:01 PM
Hi!
Can any one explain with reference the following code:

(1)Where Data is encapsulated (At which line of code does the encapsulation)?

(2) Where Data Abstraction is done(At which line of code does the abstraction)?




#include "iostream"

using namespace std;

class Rectangle
{
private:
float width,height,Area;
public:
Rectangle()
{
width = 35.0;
height = 25.0;
}

Rectangle(float w, float h)
{
width = w;
height =h;
}
void GetArea()
{
Area = width * height;
cout