Opportunity cost in economics is the cost of not having taken a better choice:
Opportunity cost is the cost difference of different choices. That is the definition we refer to here. Another definition, used in accounting, refers only to the cost of an alternative not chosen. That is covered in James A. Buchanan, opportunity cost, The New Palgrave Dictionary of Economics. Either way, opportunity cost occurs when a decision is made:
The unchosen opportunity is lost forever. What may be portrayed as choosing the unchosen opportunity later is actually choosing a different opportunity that may not be as efficient or even possible (for example, skilled persons and businesses intellectual assets having switched to a different skill and no longer available, etc.).
Compound opportunity costs depend on (are caused by) previous opportunity costs, and are also called cascading opportunity costs or reverse multiplier effect. For example, investing in under-consumption instead of multipliers.
Technological Opportunity Cost (also called Tech Opp Cost or Tech Opt Cost) is the cost of opting out of more efficient technological directions, due to lack of an anticipatory stance in developing technologies.
An example of Tech Opt Cost was the choice to implement a monolithic kernel, instead of a microkernel or hybrid kernel, in the development of a commodity operating system (OS) that is now in use. The kernels not chosen are upgrade-efficient (for code refactoring), while the monolithic kernel precludes use of the upgradable kernels in subsequent development.
That requires rewriting the entire OS when reliability and security needs arise, instead of simply making changes to the OS. The problem was known at the time of original development, and could have been prevented then.
Consider running a business in a composite good industry (of firms with complementary intellectual assets). Say you need to hire out (outsource) some of the firms innovative work in order to produce more output, for example if time or resources are limited. Not outsourcing some of the work would reduce your production output, falling below minimum production necessary to stay in the composite good industry.
Further assume that, of the different innovative tasks which could be outsourced, you can do those tasks yourself more efficiently (e.g., at lower cost) compared to outsourcing, but (as mentioned) there is not enough time or resources to do all of those tasks yourself.
The question is: what do you choose to outsource? Outsourcing any of those tasks would be more costly than doing the task yourself, but not as costly as doing it all yourself and falling out of the composite good industry.
The answer is to choose the lower opportunity costs. The highest opportunity cost would be to fall out of the composite good industry, so that would be your last choice. Next you go through the tasks that can be outsourced, and choose to oursource those that incur less opportunity costs than other tasks.
Your main intellectual asset would have the highest opportunity cost to outsource (because a composite good industry reformulates until that is so for each firm). So you would go through other tasks, to find ones to not do in-house.
This concept, called comparative advantage, extends to trade between societies (that have different money supplies international trade). The idea is to perform the more valuable work in-house or in-society, while outsourcing the relatively less valuable work that you could still do more efficiently in-house or in-society and is high value but not as high value as your core work.
That is the basic idea of comparative advantage. Economics is a multi-dimensional science, and many factors affect comparative advantage in general. For example, a changing market could affect the composite good to require you to switch to a different core competency in the future, causing you to plan to phase out your core work eventually, providing incentive to outsource it even if it is (temporarily) higher value. Likewise, an innovative task that is less valuable now may be destined to become more valuable in the future, creating incentive to not outsource that one, in order to better train and ramp up for the future.