CPP Unit 2 Edited
CPP Unit 2 Edited
CPP Unit 2 Edited
void display()
{
cout<<accno<<" "<<name<<endl;
cout<<count;
}
};
int Account::count=0;
int main()
{
Account a1(201, "Sanjay");
Account a2(202, "Nakul");
Account a3(203, "Ranjana");
a1.display();
a2.display();
a3.display();
return 0;
}
In the above example stack.h file is the stack ADT. For the end user it is enough to know what
method are supported by the class Stack and the signatures of the methods of the class. So now
the user can create the object for the Stack class, invoke methods by passing required parameters.
The file Stack.cpp consists of the implementation details of each method which is not required
for the end use.