[comp.lang.c++] HELP: invoking derived methods

skow@cs.utwente.nl (Jacek Skowronek) (06/05/91)

I need help in such question:
Let's say we have a class like this:

class MyBaseClass
{
private:
	int data1;
public:
	MyBaseClass();
	MyBaseClass(const int the_data);
	
	void setData(const int the_data);
};


and a class derived from MyBaseClass:

class MyDerivedClass : public MyBaseClass
{
private:
	int data2;
public:
	MyDerivedClass();
	MyDerivedClass(const int the_data1, const int the_data2);

	void setData(const int the_data1, const int the_data2);
};
		
Now: can the implementation of function setData look like that:

void MyDerivedClass::setData(const int the_data1, const int the_data2) : (the_data1)
{
	data2 = the_data2;
}


I have also such question:
what function will be invoked by the call to MyDerivedClass::setData(d1,d2) ?
Will it be so that first a function MyBasClass:setData(d1) will be invoked, according to the implementation ? Or maybe : (the_data1) notation applies only to constructors ?

Thanks in advance,

Jacek Skowronek

-- 
-------------------------------------------------------------------
Jacek Skowronek				e-mail: <skow@cs.utwente.nl
Departament of Computer Science
Twente University
Enschede, The Netherlands