Re: classes, strings, learning in VS.NET
From: An Ony (nowhere_at_somewhere.net)
Date: 12/02/03
- Next message: pertheli: "Effect of goto on local variables"
- Previous message: Rolf Magnus: "Re: A question about arrays."
- In reply to: Christoph Rabel: "Re: classes, strings, learning in VS.NET"
- Next in thread: An Ony: "Re: classes, strings, learning in VS.NET"
- Reply: An Ony: "Re: classes, strings, learning in VS.NET"
- Reply: Christoph Rabel: "Re: classes, strings, learning in VS.NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 2 Dec 2003 12:03:42 +0100
> > I'm just learning c++ with the book from Bjarne Stroustrup and I just
type
> > what is in his book into Visual Studio .NET. Is that a good compiler for
> > that or not? I'm beginning to have my doubts... and it needs to be ANSI
C++
>
> It is a good Compiler, at least the 2003 version.
>
> > anyway, what's wrong with this:
> > =====================>
> > class Employee {
> > short dept;
> > public:
> > Employee();
>
> Here you declare that you will provide a constructor for your Employee
> class.
>
> Later, the linker informs you that it couldnt find one. So either remove
> this line and the compiler generates a Constructor automatically for you
> or keep your promise and implement it:
>
> Employee::Employee() {
> // Do whatever is useful here
> }
>
> > };
> >
> > void main(){
>
> int main() {
>
> void is not allowed for main.
>
> > Employee e = Employee();
>
> Looks weird. Why not simply:
>
> Employee e;
>
> > }
>
ah thanks, I'll go try it now. I'm used to program in Java so that's how I
thought it was logic. And that book said, "don't declare without
initialization", so isn't "Employee e;" kinda wrong?
- Next message: pertheli: "Effect of goto on local variables"
- Previous message: Rolf Magnus: "Re: A question about arrays."
- In reply to: Christoph Rabel: "Re: classes, strings, learning in VS.NET"
- Next in thread: An Ony: "Re: classes, strings, learning in VS.NET"
- Reply: An Ony: "Re: classes, strings, learning in VS.NET"
- Reply: Christoph Rabel: "Re: classes, strings, learning in VS.NET"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|