K
Kevin Grigorenko
Hello,
I've been working on a little side project of mine in Visual Studio.NET for
about the last month. Recently, I wanted a friend of mine to help me out
with a problem and so I sent him my files and he tried to compile my project
in Visual C++ 6. A slew of random warnings and errors appeared which I
managed to solve very easily, but then I got an error that I suddenly could
not get access to a protected class within a class from that classes' member
functions. So, here is the basic layout:
class BasicRegex
{
protected:
class RegexNode
{
public:
std::vector< RegexNode *>::reference addNode();
...
};
public:
...
};
Then I had a member function in RegexNode called addNode which essentially
looked like this in my implementation file:
std::vector<BasicRegex::RegexNode *>::reference
BasicRegex::RegexNode::addNode()
{
children_.push_back(new BasicRegex::RegexNode);
return children_.back();
}
And MSVC++ 6 couldn't handle the line children_.push_back(new
BasicRegex::RegexNode); It was saying that I didn't have access to the
protected class RegexNode for some reason.
What is going on here? Have I created something that is non-standard, but
that .NET somehow accepts? Or is .NET correct, and MSVC++ 6 incorrect in
handling the nested class? What does the standard say about this situation?
Thank you,
Kevin Grigorenko
I've been working on a little side project of mine in Visual Studio.NET for
about the last month. Recently, I wanted a friend of mine to help me out
with a problem and so I sent him my files and he tried to compile my project
in Visual C++ 6. A slew of random warnings and errors appeared which I
managed to solve very easily, but then I got an error that I suddenly could
not get access to a protected class within a class from that classes' member
functions. So, here is the basic layout:
class BasicRegex
{
protected:
class RegexNode
{
public:
std::vector< RegexNode *>::reference addNode();
...
};
public:
...
};
Then I had a member function in RegexNode called addNode which essentially
looked like this in my implementation file:
std::vector<BasicRegex::RegexNode *>::reference
BasicRegex::RegexNode::addNode()
{
children_.push_back(new BasicRegex::RegexNode);
return children_.back();
}
And MSVC++ 6 couldn't handle the line children_.push_back(new
BasicRegex::RegexNode); It was saying that I didn't have access to the
protected class RegexNode for some reason.
What is going on here? Have I created something that is non-standard, but
that .NET somehow accepts? Or is .NET correct, and MSVC++ 6 incorrect in
handling the nested class? What does the standard say about this situation?
Thank you,
Kevin Grigorenko