Can we have a non static member function in a base class to
be override in derived with static modifier?
Answer Posted / srinivas
yes we can have a nonstatic membe function in the base ,
which can be override in derived class with static modiier.
for ex:
class sample
{
public:
static void get(){cout<<"this is base class
function:"<<endl;}
static void put(){cout<<"this is a put function of
base class :"<<endl;}
};
class sample1:public sample
{
public:
void put(){cout<<"this is a derived class
function:"<<endl;}
};
sample class is havinfg a non static member function put
which is overidden in dervied which static key word.
Which runs fine.
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Explain the difference between a struct and a class?
What is the difference between field and property in c#?
What is class method c#?
Explain the difference between object type and dynamic type variables in c#?
Explain About Web.config
What is Inheritance in C#?
What is constants in c#?
What is generic delegates in c#?
Is list ienumerable c#?
Wcf and what is difference between wcf and web services?
what are nullable types in c#
What is Implementation inheritance
what is IDisposal interface
Is enum a class c#?
Why do we need private constructor in c#?