Can we call a base class method without creating instance?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is static class not inherited?

577


Advantage and disadvantage of routing in telecom sector

764


Why multiple inheritance is not possible?

578


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1754


Why it is called runtime polymorphism?

559






What are main features of oop?

599


What is multilevel inheritance?

702


Why we use classes in oop?

553


what is the drawback of classical methods in oops?

2889


Is react oop?

588


What is inheritance in simple words?

600


How do you use inheritance in unity?

566


Why is polymorphism needed?

567


Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.

1981


i am getting an of the type can not convert int to int *. to overcome this problem what we should do?

1814