Re: Quick question!



Thanks David for your input!

Thankyou to all!

Later!

Best regards
Roberto


"David Wilkinson" <no-reply@xxxxxxxxxxxx> wrote in message
news:%23$WTtcwgGHA.2208@xxxxxxxxxxxxxxxxxxxxxxx
Robby wrote:

Hey David!

You did it again! :-)

*IT COMPILES WITHOUT ANY ARRORS*


So, I will try this new "Forward declaration" stuff you just tought me
with all the rest of my other pointers to objects that I want to pass to
this function. I know that Abdo mentioned it in his post as:

2. Use forward-reference *before* the #include of SFC_1.h

however this is new to me and I didn't know how to apply the syntax?
However thankyou also Abdo!

One thing though, If I do use:

class components; // forward declaration

in my SFC1.h file, what happens to all the other objects that derive from
it.... are they automatically declared also, or must I do this for all
the others too?

And David, one last question............ As a few posts back you talked
about me using the stack instead of using new which would otherwise make
me look like a Java programmer :) remember? Well.... while we are on the
subject, one of my buddies has an IT company and he says that everyone is
going on JAVA and that C++/VC++ will eventually not be very popular
anymore! This discouraged me, but I know that I must take his opinion
lightly since he is no major beer in the IT world. Anyways, I and I am
sure of it for many others, put alot of time in a language like C... what
is your opinion on the future existance of C++ and VC++?


[snip]

Robby:

When you forward declare, for example

class components; // forward declaration

you are just telling the compiler that there is a class called components.
If the compiler needs to recognize the names of other classes derived from
components, then you must forward declare those also.

A good rule to follow with headers is: Every header should compile by
itself (i.e. when included in an empty .cpp file). Forward declaration is
often sufficient to achieve this.

Just my opinion, but I would say that today .NET is a much greater threat
to traditional C/C++ than Java.

David Wilkinson






.



Relevant Pages

  • Re: Question about multiple files
    ... No. extern just means: The actual definition is somewhere else. ... the compiler can differentiate between declaration and definition just ... > declaration it finds and in this way can I write code expecting it to be ... When the compiler reaches the line foo(); ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Question about multiple files
    ... but say I declare with extern. ... > the compiler can differentiate between declaration and definition just ... >> declaration it finds and in this way can I write code expecting it to be ... > When the compiler reaches the line foo(); ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Cpp Considered Harmful
    ... >> programming language, the compiler, the IDE, the libraries, etc. ... source file, the implementation shall locate the declaration, (and ... to name one of the defining source files on the command line that initiates ... The counterpart to this in Java is accomplished using the following: ...
    (comp.lang.cpp)
  • Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
    ... ZBRENT is a function as opposed to a subroutine. ... I don't know how to tell the compiler DCPVAL is a fun and not a sub. ... That is not the same thing as being valid f77. ... declared the name of the External as real throughout, one declaration ...
    (comp.lang.fortran)
  • Re: Internal compiler error C1001 after SP6 installation
    ... Declaring variables like ... fixed it is not particularly productive to worry about why the compiler is choking. ... >The stdafx.h contains a class declaration at line 30. ... the optimizations should caused these error. ...
    (microsoft.public.vc.mfc)

Quantcast