Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » private in cdt
private in cdt [message #120168] Wed, 08 September 2004 12:20 Go to next message
Eclipse UserFriend
Originally posted by: hmetu.gmx.net

Hi!
I am using cdt2.0.1 with MinGW under eclipse and wenn I write my codes in
c++ and try to build errors (variable is private). Does it mean that
variables cannot be
declared as private here? How do I go about this?

Thanks in anticipation
Harp
Re: private in cdt [message #120481 is a reply to message #120168] Thu, 09 September 2004 11:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hmetu.gmx.net

Hi!
May be I did not compose my question well, I have the following code!
class phonebook {

char name[80];

int areacode;

int prefix;

int num;

public:

phonebook(char *n, int a, int p, int nm)

{

strcpy(name,n);

areacode = a;

prefix = p;

num = nm;

}

friend ostream &operator<<(ostream &stream, phonebook o);

};

At the declarations of name, areacode,... the compiler indicates that they
are private (correct), but it refuses to build. Does it mean that a variable
cannot be declared private?

Thanks

Harp

"Harp" <hmetu@gmx.net> wrote in message news:chnb9u$rnc$1@eclipse.org...
> Hi!
> I am using cdt2.0.1 with MinGW under eclipse and wenn I write my codes in
> c++ and try to build errors (variable is private). Does it mean that
> variables cannot be
> declared as private here? How do I go about this?
>
> Thanks in anticipation
> Harp
>
>
Re: private in cdt [message #120522 is a reply to message #120481] Thu, 09 September 2004 12:30 Go to previous messageGo to next message
Eclipse UserFriend
Harp,
I don't think anyone has answered because this sounds like a
programmer/compiler problem, not a CDT problem. If you are asking
whether or not you can declare a variable as private and initialize it
inside a constructor, then the answer is "of course". Feel free to post
your compiler error if you think this is a CDT problem, though.

Sean

Harp wrote:
> Hi!
> May be I did not compose my question well, I have the following code!
> class phonebook {
>
> char name[80];
>
> int areacode;
>
> int prefix;
>
> int num;
>
> public:
>
> phonebook(char *n, int a, int p, int nm)
>
> {
>
> strcpy(name,n);
>
> areacode = a;
>
> prefix = p;
>
> num = nm;
>
> }
>
> friend ostream &operator<<(ostream &stream, phonebook o);
>
> };
>
> At the declarations of name, areacode,... the compiler indicates that they
> are private (correct), but it refuses to build. Does it mean that a variable
> cannot be declared private?
>
> Thanks
>
> Harp
>
> "Harp" <hmetu@gmx.net> wrote in message news:chnb9u$rnc$1@eclipse.org...
>
>>Hi!
>>I am using cdt2.0.1 with MinGW under eclipse and wenn I write my codes in
>>c++ and try to build errors (variable is private). Does it mean that
>>variables cannot be
>>declared as private here? How do I go about this?
>>
>>Thanks in anticipation
>>Harp
>>
>>
>
>
>
Re: private in cdt [message #120637 is a reply to message #120522] Fri, 10 September 2004 03:05 Go to previous message
Eclipse UserFriend
Originally posted by: hmetu.gmx.net

Hi Sean!
Thanks for your concern, you are right, it was a compiler error, the wrong
library was imported....
Regards,
Harp
"Sean Evoy" <sevoy@ca.ibm.com> wrote in message
news:chq080$47h$1@eclipse.org...
> Harp,
> I don't think anyone has answered because this sounds like a
> programmer/compiler problem, not a CDT problem. If you are asking
> whether or not you can declare a variable as private and initialize it
> inside a constructor, then the answer is "of course". Feel free to post
> your compiler error if you think this is a CDT problem, though.
>
> Sean
>
> Harp wrote:
> > Hi!
> > May be I did not compose my question well, I have the following code!
> > class phonebook {
> >
> > char name[80];
> >
> > int areacode;
> >
> > int prefix;
> >
> > int num;
> >
> > public:
> >
> > phonebook(char *n, int a, int p, int nm)
> >
> > {
> >
> > strcpy(name,n);
> >
> > areacode = a;
> >
> > prefix = p;
> >
> > num = nm;
> >
> > }
> >
> > friend ostream &operator<<(ostream &stream, phonebook o);
> >
> > };
> >
> > At the declarations of name, areacode,... the compiler indicates that
they
> > are private (correct), but it refuses to build. Does it mean that a
variable
> > cannot be declared private?
> >
> > Thanks
> >
> > Harp
> >
> > "Harp" <hmetu@gmx.net> wrote in message news:chnb9u$rnc$1@eclipse.org...
> >
> >>Hi!
> >>I am using cdt2.0.1 with MinGW under eclipse and wenn I write my codes
in
> >>c++ and try to build errors (variable is private). Does it mean that
> >>variables cannot be
> >>declared as private here? How do I go about this?
> >>
> >>Thanks in anticipation
> >>Harp
> >>
> >>
> >
> >
> >
Previous Topic:org.eclipse.cdt.utils- Plugin
Next Topic:More debugging exceptions
Goto Forum:
  


Current Time: Wed May 07 19:57:09 EDT 2025

Powered by FUDForum. Page generated in 0.05458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top