oop Questions

2

Solved

What is the difference between: class A {} class B with A{} and mixin A{} class B with A{} ?
Flyback asked 5/5, 2022 at 20:15

5

Solved

I know the behavior, but I am not 100% sure on why this occurs. I understand that there is no polymorphism for instance variables in java. The variables are resolved statically by the compiler. But...
Blastoderm asked 20/8, 2012 at 21:52

3

For torch.nn.Module() According to the official documentation: Base class for all neural network modules. Your models should also subclass this class. Modules can also contain other Modules, allo...
Referent asked 18/4, 2020 at 11:19

5

Solved

Now, if the title sounds weird to you, consider this code, I was reviewing today (simplified): public class MyService( IHttpClientFactory httpClientFactory) : BaseService(), // WTF? a Method? I...
Neutron asked 20/8 at 7:27

2

Solved

I'm building a wrapper for an API. For now, it works. However, it is synchronous, using the requests module for HTTP calls. I would like to implement a way to asynchronously call these methods wh...
Crossfertilization asked 22/9, 2018 at 17:30

6

Solved

class Peoples { late int id; late String name; static final Peoples _inst = Peoples._internal(); Peoples._internal(); factory Peoples() { return _inst; } } I have this singleton class. W...
Undeniable asked 11/5, 2019 at 8:45

8

Solved

I am struggling to understand how the Single Responsibility Principle can me made to work with OOP. If we are to follow the principle to a tee, then are we not left with many classes, many of whi...

5

Solved

I know that in C# you can nowadays do: var a = new MyObject { Property1 = 1, Property2 = 2 }; Is there something like that in PHP too? Or should I just do it through a constructor or through m...
Largish asked 1/10, 2010 at 9:26

15

Solved

I have created the following Enum: from enum import Enum class Action(str, Enum): NEW_CUSTOMER = "new_customer" LOGIN = "login" BLOCK = "block" I have inherited f...
Presa asked 10/8, 2020 at 7:21

6

Solved

In C# when I want to call a static method of a class from another static method of that class, is there a generic prefix that I can use such as PHP's self:: instead of the class name? So in the be...
Durwood asked 13/5, 2009 at 12:3

3

This is really bothering me and hindering my development/debugging. Whenever I declare a variable type of the interface I'm implementing, the Locals Window doesn't show it's property values. Instea...
Meeks asked 19/3, 2015 at 13:44

9

Solved

I am doing a large project for the first time. I have lots of classes and some of them have public variables, some have private variables with setter and getter methods and same have both types. I...
Timothytimour asked 18/1, 2013 at 13:26

4

Solved

How can I define a recursive Pydantic model? Here's an example of what I mean: from typing import List from pydantic import BaseModel class Task(BaseModel): name: str subtasks: List[Task] = [] ...
Malo asked 22/6, 2021 at 22:43

1

I've seen both used interchangebly but do they really mean the same? From my understanding, Polymorphism stretches the fact that you could exchange an instance of a class by an instance of a subcla...
Camfort asked 8/9, 2010 at 18:18

4

I try to figure out what is the best practice in Python inheritance principles, when there is a 'bad idea' to change method signature in a child. Let's suppose we have some base class BaseClient ...
Handfasting asked 5/8, 2017 at 14:44

6

Solved

I'm trying to replace a function defined within a class in order to modify its function (as in inner workings) without changing the actual code. I've never done this before, and, hence, am having s...
Christlike asked 30/5, 2018 at 7:44

3

Playing around with the record type in C#, it looks like it could be quite useful to build discriminated-union-like data structures, and I'm just wondering if I'm missing some gotchas that I'll reg...
Diaphoresis asked 3/9, 2020 at 13:6

2

Solved

I Wrote the following Code public class Reader1 { private int pageNumber; private class ReaderName1{ public int getPage(){ return pageNumber; } } static class ReaderFound{ } } When I ...
Gerundive asked 25/3, 2015 at 15:45

1

Solved

I am learning SOLID principle. While learning "Dependency Inversion Principle" found out that class should depend on interfaces rather than concrete classes. Does this mean composition is...

8

Solved

Is there any way to translate this Java code into Python? class Foo { final static private List<Thingy> thingies = ImmutableList.of(thing1, thing2, thing3); } e.g. thingies is an immuta...
That asked 13/9, 2011 at 18:52

7

Solved

I have a few questions about the Adapter pattern. I understand that the class adapter inherits from the adaptee while the object adapter has the adaptee as an object rather than inheriting from it....
Anthocyanin asked 29/3, 2011 at 1:41

4

Solved

What is the example of the OOP concept 'Message Passing' in C# (calling methods/Passing parameters/Firing Events/Handling Events/???) and why is it called message passing?
Surfboard asked 27/7, 2009 at 16:7

9

Solved

I want to know the reason behind the design of restricting Abstract Methods in Non Abstract Class (in C#). I understand that the class instance won't have the definition and thus they wont be cal...
Dagda asked 25/9, 2012 at 10:29

11

While running the .Net Core 2.0 API endpoint getting below error. A suitable constructor for type 'RestDataService' could not be located. Ensure the type is concrete and services are registered fo...
Gael asked 11/5, 2019 at 4:48

5

I was going through an introduction to Smalltalk. In C++, the functions declared inside a class can be called by objects of that class, and similarly in Smalltalk a keyword, termed as message, is w...
Interne asked 28/2, 2017 at 0:45

© 2022 - 2024 — McMap. All rights reserved.