what is the meaning of const at the end of the class member function
Posted on 2010-11-09
I am not sure whether my title describe the problem correctly or not. Apologise if i have not.
I have a class called CustLoaderFactory which is derived from TargetFactory and ObjectCollector class.
class CustLoaderFactory : public TargetFactory<TsfLoader>, ,public ObjectCollector<TsfLoader>
by the way, may i know what is the purpose of <TsfLoader> in above code?
then in both TargetFactory and ObjectCollector class, it declared the member function with a const at the end.
virtual int func1(char *a, const void *b) = 0;
what is the purpose of the const 0? And how do i declare it in my body program?
class a : public b<TsfLoader>, ,public c<TsfLoader>
virtual int func 1(char *1a, const void *1b) = 0;
int a::func1(char *1a, const void *1b)
strcpy(1a, (char *)1b);
So, how do i call the func1 from my body code since it has a const at the back.
Beside that, since class a derive from class b and class c. by writing my own definition in body code for func1, am i overiding the original definition?
I am testing out some sample code to get more understanding on the c++ OOP.
Thank you in advance.