N
nick.stefanov
I have an iherited child class in which I would like to have a variable
which uses the base(parent) class. Something like this:
class Child : public Base
{
public:
Child () : Base()
{
}
private:
MyClass *var1;
MyClass has a Base class variable and also uses the Base class in its
constructor like so:
class MyClass {
public:
MyClass(char* Name, Base* base);
private:
char* name:
Base* base;
}
Is is possilbe to instantiate MyClass's base variable with Child's Base
varaible, something like this in Child.cc
Child::Child( ):Base(basename) {
var1 = new MyClass("whatevername", child's alrady instantiated base?)
Thanks
Nick
which uses the base(parent) class. Something like this:
class Child : public Base
{
public:
Child () : Base()
{
}
private:
MyClass *var1;
MyClass has a Base class variable and also uses the Base class in its
constructor like so:
class MyClass {
public:
MyClass(char* Name, Base* base);
private:
char* name:
Base* base;
}
Is is possilbe to instantiate MyClass's base variable with Child's Base
varaible, something like this in Child.cc
Child::Child( ):Base(basename) {
var1 = new MyClass("whatevername", child's alrady instantiated base?)
Thanks
Nick