| www.delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| Date: | Thu, 11 May 2006 16:52:16 -0700 |
| From: | clayne AT anodized DOT com |
| To: | cygwin AT cygwin DOT com |
| Cc: | klaas DOT thoelen AT telenet DOT be |
| Subject: | Re: how come #include "*.cpp" works? |
| Message-ID: | <20060511235216.GR18330@ns1.anodized.com> |
| References: | <44638BED DOT 5020009 AT telenet DOT be> |
| Mime-Version: | 1.0 |
| In-Reply-To: | <44638BED.5020009@telenet.be> |
| User-Agent: | Mutt/1.5.11 |
| X-Assp-Spam-Prob: | 0.00000 |
| X-Assp-Whitelisted: | Yes |
| X-Assp-Envelope-From: | clayne AT ns1 DOT anodized DOT com |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
On Thu, May 11, 2006 at 09:09:33PM +0200, Klaas Thoelen wrote:
>
> This seems a little strange to me. Does anybody know what's wrong here?
>
> Thanks and regards,
> Klaas Thoelen
It's just a classic mistake, pretty easily fixed with the following:
> datum.h
> ******
Add this:
#ifndef DATUM_H
#define DATUM_H
> class Date {
> public:
> Date();
> Date(int dd, int mm, int yy);
> int day();
> int month();
> int year();
> static void set_default(int, int, int);
> Date& add_year(int);
> Date& add_month(int);
> Date& add_day(int);
> Date& print();
> private:
> int d, m, y;
> static Date default_date;
> static bool is_leapyear(int);
> static int daysinmonth(int, int);
> };
#endif /* DATUM_H */
That ifndef construct is a one-way trap-door to prevent a doubly included file
from clobbering itself. Pretty standard.
>
> datum.cpp
> ********
> #include "datum.h"
Probably should place this after your standard includes below.
> #include <iostream>
> #include <assert.h>
> using namespace std;
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |