Here is my code:
class Foo
{
public:
Foo(const char*);
};
class Bar
{
public:
Foo bu("adfds");
};
int main()
{
return 0;
}
Foo::Foo(const char* iLoc)
{ }
When I try to create a Foo class within the Bar class, I get the syntax error when trying to pass to the constructor. Why is this the case?
I prefer this to egrunin’s answer as you don’t have to track memory allocation.