Click here to Skip to main content
16,010,553 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi...

I've been ask a question in interview in C#.

creating object of a class we can access a method .
then why to use inheritence .
Posted

1 solution

It impossible to teach OOP in a one or two Quick Answers, especially a person having no clue. Probably the topic is more serious than you might thing.

This question is totally illiterate and shows very counter-productive attitude. Someone who posed this question tends to think that if you can do something, anything else, something which you don't understand, may be not needed. Or may be this person pretended this way. Anyway, such thinking, basically, simply blocks the ways into programming. It really requires very open mind.

Inheritance is needed not to call a method, but to create a hierarchy of abstractions expressed as files. And this is not even the beginning of OOP. Real OOP starts when late binding is introduced. Again, the explanation requires a whole big article, to cover just the basic ideas and explain the main mechanisms. Education is required. If you need it, you have to spend good time at reading (hopefully, doing simple exercises as you go), before you can ask any literate questions. But every person with some brain inside the head can achieve it.

—SA
 
Share this answer
 
Comments
CPallini 23-May-13 3:30am    
5.(First sentences are incomparable...)
Sergey Alexandrovich Kryukov 23-May-13 8:32am    
Thank you, Carlo.
—SA
Nice explanation. My 5.
Sergey Alexandrovich Kryukov 23-May-13 8:32am    
Thank you, Tadit.
—SA
Most Welcome... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900