T
timor.super
Hi,
I would like to make a class, that if another class derives from this,
people has to override somes functions, obligatory.
I can do that with pure virtual function, like this :
class Test
{
public:
Test()
{
cout << "Ctor Test" << endl;
}
virtual void fToOverride() = 0;
};
but, what i would like to do, is to force to override, but that my
function do something :
class Test
{
public:
Test()
{
cout << "Ctor Test" << endl;
}
virtual void fToOverride()
{
cout << "i'm here" << endl;
}
};
I would like that people that derives from Test, have to override the
function fToOverride and when calling it, that it does output "i'm
here" and do what they have written in their derived class.
How to do that ? (i hope i've been clear enough)
Thanks for your help,
S.
I would like to make a class, that if another class derives from this,
people has to override somes functions, obligatory.
I can do that with pure virtual function, like this :
class Test
{
public:
Test()
{
cout << "Ctor Test" << endl;
}
virtual void fToOverride() = 0;
};
but, what i would like to do, is to force to override, but that my
function do something :
class Test
{
public:
Test()
{
cout << "Ctor Test" << endl;
}
virtual void fToOverride()
{
cout << "i'm here" << endl;
}
};
I would like that people that derives from Test, have to override the
function fToOverride and when calling it, that it does output "i'm
here" and do what they have written in their derived class.
How to do that ? (i hope i've been clear enough)
Thanks for your help,
S.