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 |
monkey starts climbing up a tree 20ft tall,each hour ,it hops 3ft and slips back by 2ft .how much time it wil tak to reach top of the tree?
why constructor cannt be declar virtually? why destructor cannt be overloaded?
What is polymorphism in oop example?
What is abstraction with example?
what is single inheritance?
what is the definition of incapsulation
What is the difference between pass by reference and pass by value?
Write on signed and unsigned integers and give three (3) examples each
Write A Program using Single and Multiple Inheritance.
What is a scope resolution operator?
How do you explain polymorphism?
what is the difference between function template and template of function?explain with example.