
















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!

















void main() { Circle c1,c2(7);
cout<<“The area of c 1 :” <<c1.getArea()<<“\n”;
//c1.raduis = 5;//syntax error c1.setRadius(5);
cout<<“The circumference of c 1 :” << c1.getCircumference()<<“\n”;
cout<<“The Diameter of c 2 :” <<c2.getDiameter()<<“\n”; }
void main() { Circle c(7); Circle *cp1 = &c; Circle *cp2 = new Circle(7);
cout<<“The are of cp 2 :” <<cp2->getArea();
}
class Time { private: int hour,minute,second; public: Time(); Time(int h,int m,int s); void printTime(); void setTime(int h,int m,int s); int getHour(){return hour;} int getMinute(){return minute;} int getSecond(){return second;} void setHour(int h){hour = h;} void setMinute(int m){minute = m;} void setSecond(int s){second = s;} ~Time(); };*
**Time::Time() { hour = new int; minute = new int; second = new int; *hour = minute = second = 0 ; }
**Time::Time(int h,int m,int s) { hour = new int; minute = new int; second = new int; *hour = h; minute = m; second = s; }
**void Time::setTime(int h,int m,int s) { *hour = h; minute = m; second = s; }
Dynamic locations should be allocated to pointers first