This is very basic question from programming point of view but as I am in learning phase, I thought I would better ask this question rather than having a misunderstanding or narrow knowledge about the topic.
So do excuse me if somehow I mess it up.
Question:
Let's say I have class A,B,C and D
now class A
has some piece of code which I need to have in class B,C and D
so I am extending class A
in class B, class C, and class D
Now how can I access the function of class A
in other classes, do I need to create an object of class A
and than access the function of class A
or as am extending A
in other classes than I can internally call the function using this parameter.
If possible I would really appreciate if someone can explain this concept with code sample explaining how the logic flows.
Note
Example in Java, PHP and .Net would be appreciated.