Questions tagged [sealed]

The sealed modifier keyword prevents a C# class from being inherited. Similar to the final keyword in Java.

The sealed modifier keyword prevents a C# class from being inherited. Similar to the final keyword in Java.

183 questions
0
votes
1 answer

Why do I not have access to App.xaml.cs from other classes in my app?

I'm trying to declare a global var in App.xaml.cs this way: sealed partial class App : Application { public static string SessionKey { get; set; } . . . I added a "Loaded" event to the map in MainPage.xaml.cs:
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
0
votes
3 answers

Does .Net itself have classes which cannot be inherited from?

I am curious to know if there are any samples in c#. I can't think of a single sample forbidding inheritance rather than some commercial intentions, so I would like to know some real world examples in c# itself. I know about sealed classes, I'm…
Hossein
  • 24,202
  • 35
  • 119
  • 224
0
votes
3 answers

Why is the BitmapImage a sealed class?

I was about to inherit from the BitmapImage class when I noticed it was sealed, I've had a quick look around but I can't find a reason it is sealed. Any body know why this is? Thanks
TWith2Sugars
  • 3,384
  • 2
  • 26
  • 43
0
votes
1 answer

How to define members of a sealed abstract class in a nice way?

I was wondering if there is a nicer way of doing this: sealed abstract class Edge(val id: String) case class LabeledEdge(override val id: String, label: String) extends Edge(id) case class WeightedEdge(override val id: String, weight: Double) …
rlegendi
  • 10,466
  • 3
  • 38
  • 50
0
votes
1 answer

return values from a class

How can i return a value from a a function in a Sealed Partial class? I use the usercontrols like this. I have a usercontrol that calls another one that is a list. When i selected a row from this list, i call …
0
votes
1 answer

Extending sealed class

I'm developing Windows Store application using javascript. I also have WinRT library for client-server interactions. Client receives from server a custom class User, which is sealed, as it's required for classes in WinRT lib. I need to extend User…
Yury Pogrebnyak
  • 4,093
  • 9
  • 45
  • 78
0
votes
1 answer

accessing an instantiated sealed class public member

i am trying to instatiate a public sealed class in my program, the thing is, ...as i am still fresh C# .net not-yet Developer , i find this issue a little difficult ... As for the problem in Question, you can skip straight to Program example, or…
LoneXcoder
  • 2,121
  • 6
  • 38
  • 76
0
votes
1 answer

explicitly new a sealed method

Let's say I have this code: interface class IFoo { public: void foo(); }; ref class FooBase : public IFoo { public: virtual void foo() sealed = IFoo::foo { } }; I need to define a new explicit foo() in a derived class, that overrides…
Marius Bancila
  • 16,053
  • 9
  • 49
  • 91
0
votes
1 answer

How to create a sample java.lang.SecurityException: sealing violation: package .. is sealed

we've an issue with a long-running Java process suddenly spitting out java.lang.SecurityException: sealing violation: package .. is sealed after overwriting a sealed jar while the JVM is running. I kind of understand this exception, but in order to…
Axel Podehl
  • 4,034
  • 29
  • 41
0
votes
3 answers

Virtual methods without body in a sealed class

When I try to run the following code it errors. private sealed class ReqHandler { public ReqHandler(object @object, IntPtr method); public virtual IAsyncResult BeginInvoke(object[] args, AsyncCallback callback, object @object); public…
user1388129
  • 9
  • 1
  • 3
-1
votes
0 answers

trust & observables - how could we safeguard the input of an observable

In this instance the boar god is only receiving textual messages, what design pattern would help to safeguard the message sender and prevent spoofing? What could we pass in or contain in the component proper to wake the boar god from his distant,…
-1
votes
1 answer

Does extending a sealed class cause recursion

sealed class MySealedClass { data class MyDataClassInsideSealed(): MySealedClass() } Wouldn't this cause an infinite loop?
Cloud Town
  • 83
  • 5
-1
votes
1 answer

Best workaround for not being able to inherit a sealed class?

I am making a program that processes thousands of files. For each file I create a FileInfo instance, but I am missing some methods and properties that I need. I wanted to make my own custom FileInfo class by inherting from FileInfo, but that class…
Mytzenka
  • 205
  • 1
  • 3
  • 16
-1
votes
3 answers

What does the sealed modifier represent in Kotlin?

I am little confused about the use of the sealed modifier. What does it do?
user8166497
-1
votes
5 answers

C# sealed class vs. no public constructor

I am currently trying to get deeper into the .NET framework. I ran across an error while I was wondering if I could create two CommandManagers: Cannot create an instance of CommandManager because it has no public constructors. Obviously it means:…
Johannes Maria Frank
  • 2,747
  • 1
  • 29
  • 38
1 2 3
12
13