Can we call a base class method without creating instance?
Answers were Sorted based on User's Feedback
Answer / nk
Onlu static methods can be called without creating any
instance of the class.
| Is This Answer Correct ? | 23 Yes | 1 No |
Answer / amit sharma
U've to derieve the class first and then when u instanciate
the derieved class. Then :-
U can call it using derieved class object or in a derieved
class member function depending upon base class fun's acess
specifer and inheritence specifier.
| Is This Answer Correct ? | 11 Yes | 1 No |
Answer / sanjay makwana, puna
e.g. class X
{
int x;
X()
{
cout << "X";
}
public :
static void fun()
{
cout << "fun";
}
};
you may called like
X::fun();
| Is This Answer Correct ? | 10 Yes | 3 No |
Answer / vijaya
by declaring that method as static we have call it without creating instance of that class.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is a class and object?
I am DeePu sotware engineer working with EMC corporation ,recently I had attended mcafee interview . Their questions were at heights of stupidity , I don't know what they want , I am a developer with 4 year experienced .I am listing the questions asked 1:What is the flag in g++ to avoid structure padding 2:In wht order parameters are passed to stack 3:How you will edit code segment of an exe
What is the difference between inheritance and polymorphism?
Explain polymorphism? What r the types of polymorphism? pls give examples?
Templates mean
what is virtual function?
What is the real life example of polymorphism?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
sir plz send me a set of questions that been frequently held in written examination during campus selection.
what is code for call by value and call by reference?
i got a backdoor offer in process global,Bangalore..Can i work with it?
what are the disadvantages of C++?
25 Answers ATS, Infosys, UNI, Wipro,