liskov-substitution-principle Questions
6
Given this code:
trait Base {
fn a(&self);
fn b(&self);
fn c(&self);
fn d(&self);
}
trait Derived : Base {
fn e(&self);
fn f(&self);
fn g(&self);
}
struct S;
...
Countertype asked 20/2, 2015 at 15:49
0
I would like pyright installed by Mason to use the current conds environment, that is the one used when opening neovim.
If I put a pyrightconfig.json shown below in root dir of my project, this wil...
Minx asked 8/3, 2023 at 7:28
2
Solved
How does mypy apply the Liskov substitution principle to *args, **kwargs parameters?
I thought the following code should fail a mypy check since some calls to f allowed by the Base class are not al...
Toreador asked 15/1, 2023 at 19:19
2
Solved
This question has been asked and answered a bunch of times, but none of the answers seem to work for me.
I've been trying to get clangd set up in nvim lsp. I used bear to generate compile_commands....
Moorhead asked 13/12, 2022 at 13:53
8
Solved
See the definition of System.Array class
public abstract class Array : IList, ...
Theoretically, I should be able to write this bit and be happy
int[] list = new int[] {};
IList iList = (IList)...
Recognition asked 11/5, 2011 at 18:15
35
Solved
I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?
Boys asked 11/9, 2008 at 15:17
6
My understanding of the Liskov substitution principle is that some property of the base class that is true or some implemented behaviour of the base class, should be true for the derived class as w...
Bordelaise asked 14/11, 2009 at 18:30
3
Just a thought and a question to the Stack Overflow and Microsoft Development Community about the OO software design principles called SOLID. What is the difference between the Liskov Substitution ...
Licentious asked 9/10, 2019 at 8:44
1
I am running into an issue with Liskov Substitution Principle and am not quite sure what would be the best way to go around it.
Code in question
class BaseModel:
def run(self, base_model_input: Ba...
Gam asked 9/3, 2021 at 16:51
3
Solved
I've just wondered if there is a difference between the IS-A (which is the UML terminology and OOP) and Liskov Substitution Principle (LSP)?
Actually, both are talking about the inheritance. So wh...
Carcajou asked 30/8, 2017 at 4:38
3
Solved
Is there any core difference between Liskov Substitution Principle (LSP) and Interface Segregation Principle (ISP)? Ultimately, both are vouching for designing the interface with common functionali...
Aspa asked 1/2, 2019 at 13:39
1
Solved
I'm coming from a Java background, and I'm trying to wrap my head around Haskell's type system.
In the Java world, the Liskov Substitution Principle is one of the fundamental rules, and I'm trying ...
Protoxide asked 1/8, 2020 at 21:34
1
Solved
I have the following code:
type T = { foo: string }
var t: T = { foo: 'foo' }
interface S { foo: string }
var s: S = t
So we know that T < S.
How about this?
t = s
Ok so S < T is also...
Hydrazine asked 5/10, 2019 at 19:34
2
Solved
This LSP violation raises a Fatal Error:
abstract class AbstractService { }
abstract class AbstractFactory { abstract function make(AbstractService $s); }
class ConcreteService extends AbstractSer...
Proverb asked 17/6, 2016 at 19:56
8
Given the following class:
class Example implements Interface1, Interface2 {
...
}
When I instantiate the class using Interface1:
Interface1 example = new Example();
...then I can call only ...
Unsteady asked 14/1, 2019 at 15:25
4
Solved
A Leaf in the Composite Pattern implements the Component interface, including Add, Remove, and GetChild methods that a Leaf is never going to use. This seems to be a violation of the Interface Segr...
design-patternscompositesolid-principlesliskov-substitution-principleinterface-segregation-principle
Xeric asked 16/10, 2009 at 18:3
3
Solved
One of the rules that Liskov Substitution Principle imposes on method signature in derived class is:
Contravariance of method arguments in the subtype.
If I understood correctly, it is saying ...
Preemie asked 31/10, 2016 at 10:24
4
Solved
Suppose I have an abstract class like:
public abstract class Pet {
private final String name;
public Pet(String name) {
this.name = name
};
public abstract boolean getsSpecialTreatment();
...
Ayer asked 6/6, 2011 at 18:35
2
I want to separate data from source of the data. One class for database interaction and class for data manipulation. But my approach violates LSP: preconditions cannot be strengthened in a subtype ...
Pestilent asked 3/8, 2015 at 3:20
4
Solved
For example we have the following structure:
class Base
{
[pure]
public virtual bool IsValid(/*you can add some parameters here*/)
{
//body
}
}
class Child : Base
{
public override bool IsV...
Unruh asked 26/4, 2018 at 15:4
3
Solved
Can you explain Liskov Substitution Principle (The 'L' of SOLID) with a good C# example covering all aspects of the principle in a simplified way? If it is really possible.
Welcher asked 13/12, 2010 at 12:18
3
Solved
I'm trying to understand Covariance and LSP. From this question I can see C# does not support return type covariance. However Liskov substitution principle imposes covariance on return type.
Does...
Muncey asked 10/5, 2017 at 12:15
2
Solved
Consider this ruby example
class Animal
def walk
# In our universe all animals walk, even whales
puts "walking"
end
def run
# Implementing to conform to LSP, even though only some animals r...
Doubloon asked 8/6, 2017 at 17:47
3
Solved
I'm asking this more out of curiosity rather than really being concerned with it, but I've been wondering whether or not the JavaScript event system violates the Liskov substitution principle (LSP)...
Sporophyll asked 6/4, 2017 at 1:28
1
Solved
I was reading why array covariance in Java is bad (Why are arrays covariant but generics are invariant?). If a Dog is a subtype of Animal, then a Dog[] is a subtype of Animal[]. This is a problem b...
Clifton asked 6/3, 2017 at 22:41
1 Next >
© 2022 - 2025 — McMap. All rights reserved.