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
What is meant by console programming?
What are value types in c#?
What is global namespace in c#?
What is generic and non generic collections in c#?
How do you name a variable in c#?
Is c# an array?
What is querystring in c#?
What is sqlcommandbuilder c#?
What is type class in c#?
In the page load event I assigned dropdownlist’s datasource property to a valid list. On the submit button click.. The same datasource property is coming as null. Why?
What do you mean by for each loop?
What is the benefit of interface in c#?
Why are dynamic link library used over static one?
What is data hiding in c#?
Why we use get set property in c#?