Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two classes Class1 and Program a shown below:
class Class1
 {
     public void xx()
     { 

     }
 }

 class Program : Class1
 {
     static void Main(string[] args)
     {

     }
 }


Here is the output from SOS debugger......
!dumpmt -md  00153898
EEClass:      00151474
Module:       00152ea4
Name:         ConsoleApplication24.Program
mdToken:      b1d44c0002000003
File:         E:\c#\ConsoleApplication24\ConsoleApplication24\bin\Debug\ConsoleApplication24.exe
BaseSize:        0xc
ComponentSize:   0x0
Slots in VTable: 6
Number of IFaces in IFaceMap: 0
--------------------------------------
MethodDesc Table
   Entry MethodDesc      JIT Name
530ba790   52e94cd8   PreJIT System.Object.ToString()
530be290   52e94ce0   PreJIT System.Object.Equals(System.Object)
530be1a0   52e94d00   PreJIT System.Object.GetHashCode()
531417b0   52e94d14   PreJIT System.Object.Finalize()
0015c038   0015388c     NONE ConsoleApplication24.Program..ctor()
0015c030   0015387c      JIT ConsoleApplication24.Program.Main(System.String[])


But why here i not seen the inherited functions ( ie xx() from Class1 )in "Program class"??????
Because when i create instance of Program class and access method xx() then how it finds the
method????
Posted
Comments
OriginalGriff 10-Nov-12 9:43am    
Don't create a new question to add information - use the Improve Question widget instead.
I have deleted the "spare" question.
Abhishek Pant 10-Nov-12 9:54am    
it seems that you didn't created a object to inherit the property of class1

1 solution

The compiler already knows it is non-virtual so it directly generates a call to Class1.xx(). Use ildasm.exe to look at the generated IL.
here the address of the method xx() from Class1's method table is burn by clr and emits call to it.Here clr not required the object reference to class1's method table.......clr does it automatically....
 
Share this answer
 
Comments
Nelek 10-Nov-12 11:06am    
Is this a solution (it doesn't look like it)? or are you giving further information? You were already told to use the widget "improve question" if you need to edit the text and/or add information to your message
fdiu 10-Nov-12 13:54pm    
Why its not looks like solution ?
It is solution... :-)

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