#include <iostream.h>
#include <stdlib.h>
class Area
{
    private:
       int length;
       int breadth;

    public:
       Area(): length(5), breadth(2){ }   /* Constructor */
       void GetLength()
       {
           cout<<"Enter length and breadth respectively: ";
           cin>>length>>breadth;
       }
       int AreaCalculation() {  return (length*breadth);  }
       void DisplayArea(int temp)
       {
           cout<<"Area: "<<temp;
       }
};
int main()
{
    Area A1,A2;
    int temp;
    A1.GetLength();
    temp=A1.AreaCalculation();
    A1.DisplayArea(temp);
    cout<<endl<<"Default Area when value is not taken from user"<<endl;
    temp=A2.AreaCalculation();
    A2.DisplayArea(temp);
    return 0;
}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

All Notes on BCA

All Notes  on BCA
BCA all subjects notes

Total Pageviews

Translate

Powered by Blogger.

Copyright © All Notes on BCA