J
John Goche
Hello,
I have come across a class whose structure looks like this:
class Foo {
public:
// ...
private:
FooMarker *fooMarker;
};
class FooMarker {
public:
inline FooMarker(): myStr(0) { }
private:
inline FooMarker(const char *str): myStr(str) { }
friend class Foo;
const char *myStr;
};
----------------------------------------------------
Why not just:
class Foo {
public:
// ...
private:
const char *fooMarker;
};
Seems quite useless to me. Any suggestions?
I would be surprised if such a class were created
just for the sake of adding a class. There must be
some better reason for this.
Thanks,
JG
I have come across a class whose structure looks like this:
class Foo {
public:
// ...
private:
FooMarker *fooMarker;
};
class FooMarker {
public:
inline FooMarker(): myStr(0) { }
private:
inline FooMarker(const char *str): myStr(str) { }
friend class Foo;
const char *myStr;
};
----------------------------------------------------
Why not just:
class Foo {
public:
// ...
private:
const char *fooMarker;
};
Seems quite useless to me. Any suggestions?
I would be surprised if such a class were created
just for the sake of adding a class. There must be
some better reason for this.
Thanks,
JG