Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Class, function, construcor and overload....Need help

0 views
Skip to first unread message

Allen

unread,
Aug 2, 2009, 8:43:53 PM8/2/09
to
This declaration of class is a part of a program. This program will build,
but will have compiler error.
Can anybody tell me if there is anything in this declaration below? If you
notice; I am writing below the declaration and implementation files. They
have overloading of the constructor and functions
*.cpp

#include "stdafx.h"

#include "Time.h"

#using <mscorlib.dll>

using namespace System;

using namespace System::IO;

Time::Time (String* pthv, String* dtv)
{
path = pthv;
data = dtv;

}

Time::Time (String* pthv )
{
path = pthv;

}

Time::Time ( String* pthv, Char dgv )
{
path = pthv;
digit = dgv;
}

void Time::WriteFile ()
{
FileStream* fs = new FileStream(path, FileMode::OpenOrCreate);
StreamWriter* sw = new StreamWriter(fs); // Create a StreamWriter
sw->Write(data);
sw->Flush();
sw->Close();
}

void Time::WriteFileApnd()
{
FileStream* fs = new FileStream(path, FileMode::Append); // Show the
time and that the signing is"in" (minus sign)
StreamWriter* sw = new StreamWriter(fs);
sw->WriteLine(data); //b
sw->Flush();
sw->Close();
}

Char Time::RedFile()
{
FileStream* fs = new FileStream(path, FileMode::Open);// Check to see
that the last signing
StreamReader* sr = new StreamReader(fs); // was "in" to avoid
signing "in" twice
digit = sr->Read();
return digit;
}
/***************************************************************************/
*.h


using namespace System; //Is very important to be put in this header file,
Otherwise you will get eror C2143 and C2501
//static Char mark;

__gc class Time
{
private:

String* path;
String* data;
Char digit;

public:

Time (String* path, String* data);
Time (String* path);
Time (String* pthv, Char dgv);


void WriteFile ();
void WriteFileApnd();
Char RedFile();

--
Thanks
Allen

Giovanni Dicanio

unread,
Aug 19, 2009, 7:08:44 PM8/19/09
to
Allen ha scritto:

> This declaration of class is a part of a program. This program will
> build, but will have compiler error.

> [...]

Sorry, but this newsgroup is Italian only.

You may post your question to an English C++ newsgroup.
In particular, considering that your code seems to me C++/CLI code, you
may use microsoft.public.dotnet.languages.vc newsgroup (which is about
C++/CLI).

HTH,
Giovanni

0 new messages