{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Jan 30 - Day=other.day Month=other.month/main.cc#include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Jan 30, 2006, ECE106 Classes/Objects //Definition – dayofyear.h //------------------------------------------------ class DayofYear{ private: int day; int month; public: void setDay(int d); void setMonth(int m); void print(); void copy(DayofYear other); }; //--------------------------------------------------- //Implementation – dayofyear.cc //--------------------------------------------------- #include “dayofyear.h” Void DayofYear::setDay(int d){ Day=d; } Void DayofYear::setMonth(int m){ Month=m; } Void DayofYear:print(){ Cout<<day<<” “<<month<<endl; } Void DayofYear::copy(DayofYear other){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Day=other.day; Month=other.month; } //------------------------------------------------------//main.cc //------------------------------------------------------#include “dayofyear.h” Int main(){ DayofYear FIrstofJuly; DayofYear Christmas; FirstofJuly.day=1; //illegal – private variable FirstofJuly.month=7; //illegal FirstofJuly.setDay(1); FirstofJuly.print(); FirstofJuly.copy(Christmas); Return 0; } //---------------------------------------------------------%g++ -c main.cc %g++ -c dayofyear.cc %g++ main.o dayofyear.o –o main.exe...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

Jan 30 - Day=other.day Month=other.month/main.cc#include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online