I have not found anything that addresses these questions. Any help is appreciated. If I have a class that has pointers to objects of a user-defined class as members, is there any problem with initializing those pointers with the initialization list of the constructor? For example, where A, B, and C are all user-defined classes:
class A{
public:
//Constructor
A(B *b, C *c) : member1(b), member2(c){}
private:
B *member1;
C *member2;
};
Also, is there any problem with initializing members of a class and passing parameters to the base class constructor in the same initialization list? For example:
class Base{
public:
//Constructor
Base(foo f) : baseMember(f){}
private:
foo baseMember;
};
class Derived: public Base{
public:
//Constructor
Derived(foo f, bar b) : Base(f), derivedMember(b){}
private:
bar derivedMember;
};