What is static polymorphism
0. Ask a question
What is polymorphism?
PolymorphismLiterally means multiple forms. Polymorphism is used when there is a hierarchical structure between classes and the classes are linked by inheritance.
What types of polymorphic atmospheres?
Polymorphism can be divided into static polymorphism and dynamic polymorphism.
Also known as compile-time polymorphism, during system compilation you can determine what function the program will perform. For example, function overloading, performing member functions with object names and dot operators, and the operations specified by class member operators are all static polymorphisms. Among other things, overloading differentiates between function names when creating a symbol table. This determines what function the program will perform here. The object name plus the dot operator to perform the member function and the operation specified by the class member operator are invoked through this pointer.
Here a class A is defined with a member function and an element. We extract the following assembler code of the program:
We can see here that it is a lea instruction to set the address of the a object directly into the eax register, which is the object's this pointer, and then use the call instruction to go to the set function to jump, which means that its assembly language code knowing where to go and what function to have is also known as static polymorphismCompile-time polymorphism。
This shows that different calls are actually implemented and that this happens at runtime. So how is the end of the virtual function implemented?Assembly code and its object model：
From the assembler code in the figure above, we can see that a series of pointer dereferencing processing has been performed here and the value of this pointer to be stored in eax is being finally determined. To understand this, we need to understand the subclass object model.
- What is the curriculum for Pharm D.
- What are some strong emotional songs
- What prevents acne scars from fading
- What is 50 2 1
- What makes someone an atheist
- Is staged Gordon Ramsays Kitchen Nightmares
- How often do RAF jets intercept planes
- What is asthenozoospermia and its treatment
- What is the definition of social network
- What's your optional strategy
- Difference between simplex and revised simplex
- Safavids are a Turkish-Azerbaijani dynasty
- When will Star Trek 12 be released?
- How to download GTA 5 1
- What if I delete my Facebook account
- All languages are made up
- Is the nucleolus membrane bound
- Is an ACCA professionally based in India
- What can Django do if the bottle can't
- How can a causality be determined
- Who invented football 1
- Why did you leave Mumbai
- What is a watercolor tattoo
- How does goldfish taste
- Is the ACE test suite the best
- There are free Google AdWords campaigns
- What foods are bad for geckos
- How can I get certified in Tally
- What is the best definition of globalization
- What purpose do giraffes serve
- What podcasts talk about marketing and advertising
- How much do self-employed doctors earn
- Are rumors about jgec true
- What does functional fixation mean in psychology