Questions tagged [explicit]

6 questions
11
votes
1 answer

Implicit vs explicit interfaces

I think I understand the actual limitations of compile-time polymorphism and run-time polymorphism. But what are the conceptual differences between explicit interfaces (run-time polymorphism. ie virtual functions and pointers/references) and…
9
votes
2 answers

Constructor vs casting operator

I'm programming a library (so I have complete access to all the mentioned classes). Two classes (A and B) are essentially the same and differ only by their implementation, so they can easily be converted into one another. But I'm asking myself, if…
user108376
7
votes
4 answers

The need for Explicit Type Conversion in C#

Consider the following code: DerivedClass drbObj = (DerivedClass)obj; Here obj is of type Object and this is reasonable since Object is the base type of every Class in C#. Here, since the type of derObj is defined at compile time, what is the need…
Shamim Hafiz - MSFT
  • 4,123
  • 7
  • 38
  • 46
0
votes
1 answer

What information should one infer from a class header that marks its constructor explicit?

If a class is written well, you should be able to gleam all relevant information about the class simply by looking at its header. If one sees that the constructor is marked explicit: What should one assume to be absolutely true about this…
Anon
  • 3,565
  • 3
  • 27
  • 45
0
votes
5 answers

Is setting field's fields in a submethod without passing argument a good pattern?

Simplified a little, I have this code: public class TaskProcessCases{ private Assessment assessment ; public void execute() { // the actual name for (Case case : cases) { assessment = new Assessment(); //…
Mark
  • 662
  • 5
  • 12
0
votes
3 answers

Is there any technical reason to be concerned with casting speed?

So, I'm working on a project that takes a very complex entity from a third party framework and converts it into the native object that defines that entity. This entity has several one-to-many relationships, and a few of those have some one-to-many…
Sidney
  • 191
  • 5