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 states of a thread in c#?
If casting fails what type of exception is thrown?
What is the use of ispostback in c#?
Explain the difference between .net and c#?
What is difference between struct and class in c#?
What is datasource c#?
How are methods overloaded?
Why delegates are safe in c#?
What is the benefit of using interface in c#?
How do I format in c#?
What is dictionary collection in c#?
What is different about switch statements in c#?
Define sealed classes in c#?
What is parsing? How to parse a date time string?
Can a constructor have a return type?