word and its explanation

Liskov Substitution Princple, LSP
For every object "o1" from type "t1",
there is object "o2" from type "t2", when all "o2" is replaced with "o1" in
program "p" defined in T1, the program behavior of "p" doesn‘t change,
therefore, type "t2" is the sub type of "t1"

it looks like the structure in the program.


class FruitInventory
{
void AddFruit(Fruit p)
{
}
}

class Apple : Fruit
{
}

static void Main()
{
FruitInventory fruitInvt = new FruitInventory();
fruitInvt.AddFruit(new Apple());
}

word and its explanation

时间: 2024-12-29 06:48:16

word and its explanation的相关文章

422. Valid Word Square

题目: Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k < max(numRows, numColumns). Note: The number of words given is

LeetCode Valid Word Square

原题链接在这里:https://leetcode.com/problems/valid-word-square/ 题目: Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k < max(

[LeetCode] Word Squares 单词平方

Given a set of words (without duplicates), find all word squares you can build from them. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k < max(numRows, numColumns). For example, the wor

Leetcode: Word Squares &amp;&amp; Summary: Another Important Implementation of Trie(Retrieve all the words with a given Prefix)

Given a set of words (without duplicates), find all word squares you can build from them. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k < max(numRows, numColumns). For example, the wor

[LeetCode] Valid Word Square 验证单词平方

Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤k < max(numRows, numColumns). Note: The number of words given is at le

史上最强大Java Word文件打印方案

    客户要求Word必须支持高级功能(如支持打印份数.单双面打印),而我们又不能使用第三方插件,开源的包如poi.jacob对word打印的支持实在有些无奈,木有办法,搜索.查阅了无数资料,一直没有好的解决方案. 某日深夜,小手一抖,搜到一终极方案,特此分享: This is probably not the most efficient method, but it works if you have MS Word. You can use this command to get Wor

[LeetCode] Longest Word In Dictionary

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest l

Hash Table-720. Longest Word in Dictionary

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest l

leetcode 720. Longest Word in Dictionary

Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest l