C++: Accessing variables present only in one of the derived classes
void func1()
{
}

class Base
{
	public:
		virtual void memfunc() = 0;
};
class DerivedA: public Base
{
	public:
		virtual void memfunc() = 0;
};
class Derived1: public DerivedA
{
	public:
		void memfunc()
		{  func1();
		}
};
class Derived2: public DerivedA
{
	public:
		int* pbuf;
		int val;

		void func2(int* pbuf,int val)
		{
         		/* update pbuf depending on the value of val*/
		}

		void memfunc()
		{  func1();
		    func2(pbuf,val);
		}
};
class user{
	public:
	Base* mBase;
	void userfunc()
	{
		mBase = f(); //Object pointer to Derived1/Derived2 will be assigned based on dynamic loading;
//Before calling the below func, I Need to assign value to the 'val' variable of the class 'Derived2'
		mBase->memfunc();
	}

};
int main()
{
	user ouser;
	ouser.userfunc();
	return 0;
}

The variables val and pbuf are present in Derived2 only. 
How can I assign values to them in userfunc/main as I don't know if the object mBase would point to Derived1/Derived2.
C++: Accessing variables present only in one of the derived classes
===

void func1()
{
}

class Base
{
	public:
		virtual void memfunc() = 0;
};
class DerivedA: public Base
{
	public:
		virtual void memfunc() = 0;
};
class Derived1: public DerivedA
{
	public:
		void memfunc()
		{  func1();
		}
};
class Derived2: public DerivedA
{
	public:
		int* pbuf;
		int val;

		void func2(int* pbuf,int val)
		{
         		/* update pbuf depending on the value of val*/
		}

		void memfunc()
		{  func1();
		    func2(pbuf,val);
		}
};
class user{
	public:
	Base* mBase;
	void userfunc()
	{
		mBase = f(); //Object pointer to Derived1/Derived2 will be assigned based on dynamic loading;
//Before calling the below func, I Need to assign value to the 'val' variable of the class 'Derived2'
		mBase->memfunc();
	}

};
int main()
{
	user ouser;
	ouser.userfunc();
	return 0;
}

The variables val and pbuf are present in Derived2 only. 
How can I assign values to them in userfunc/main as I don't know if the object mBase would point to Derived1/Derived2.