




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















►
►
►
class Student{… public:
Studen();Student(char * aName);void setRollNo(int aNo); };
int main(){
Student obj;Student *ptr;ptr = &obj;ptr->setRollNo(10);return 0; }
Breakup of new Operation
►
Allocating space in memory Calling the appropriate constructor
Design a class date through which user must be ableto perform following operations
^
Get and set current day, month and year ^
Increment by x number of days, months and year ^
Set default date
►
This attribute must be declared a static member
class Date{
int day;int month;int year;static Date defaultDate; … };
►
class Date{… public:
void setDay(int aDay);int getDay() const;void addDay(int x);… … };
Constructors and Destructors in
Date.h
Date(int aDay = 0,
int aMonth= 0, int aYear= 0); ~Date(); //Destructor };
Implementation of Date Class
►
Date Date::defaultDate (07,3,2005);