Is such initialization very bad?
class A
{
public:
~A();
A();
B &b;
};
A::~A()
{
delete &b;
}
A::A() :
b(*(new B()))
{
}
All I want is to access member "b" without "->" operator. Also I can't make class B to be part of class A because class B is incomplete in A class' header.
UPDATE: Thanks for answers! If you need more info, class B here represents a "signal" (list of callbacks). And in 99% cases this class is just member of other class (not pointer or reference). But one particular class (A in my example) can't include class B header. Still I want this signal in class A to be connected and called like any other signal:
object->signal.connect(...);
object->signal();
With dot, not "->". Class A can't include class B header because there are template classes that inherit class A...