Topic: <object>::<typedef> or only <class>::<typedef> ?
Author: "Gutterman Zvika" <zvik@cs.technion.ac.il>
Date: 1999/10/30 Raw View
I was wondering if using internal class typedef is possible using from an
object or only
when using class name?
for example:
class A { typedef int foo; };
...
A a;
A::foo B; // thats legal
a::foo a; // is that legal also?
...
I looked into the standard and found no reference about it.
When I tried it in the Microsoft Visual c++ 6.0 it came back with the error:
" error C2653: 'a' : is not a class or namespace name "
the thing is that on microsoft documentation
there is nothing on that error .. (there is help for c2652 and for c2654
but nothing for c2653 ..)
Any ideas?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/10/30 Raw View
Gutterman Zvika wrote:
> I was wondering if using internal class typedef is possible using from an
> object or only when using class name?
Only with a type name (the class name or a typedef to the
class).
> for example:
>
> class A { typedef int foo; };
>
> ...
> A a;
>
> A::foo B; // thats legal
Correct
> a::foo a; // is that legal also?
No, it isn't.
--
Valentin Bonnard
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Darin Adler <darin@bentspoon.com>
Date: 1999/10/30 Raw View
Gutterman Zvika <zvik@cs.technion.ac.il> wrote:
> I was wondering if using internal class typedef is possible using from an
> object or only
> when using class name?
>
> for example:
>
> class A { typedef int foo; };
>
> ...
> A a;
>
> A::foo B; // thats legal
> a::foo a; // is that legal also?
> ...
>
> I looked into the standard and found no reference about it.
> When I tried it in the Microsoft Visual c++ 6.0 it came back with the error:
>
> " error C2653: 'a' : is not a class or namespace name "
Only class or namespace names can appear before "::". To quote the standard,
paragraph 3.4.3/1:
"During the lookup for a name preceding the :: scope resolution operator,
object, function, and enumerator names are ignored. If the name found is not
a class-name (clause 9) or namespace-name (7.3.1), the program is
ill-formed."
-- Darin
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]