473,656 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abstract/Sealed method

TJM
Hi,

Is it possible to have a method sealed and abstract at the same time? MSDN
states clearly that this is not allowed for classes but it does not mention
it for methods. I tried with a simple example and the compiler would not
allow me to compile, however in a recent interview, I was asked this
question and the interviewer claimed that this is used in certain
situations! I am baffled!

Thanks,
TJM
May 20 '06 #1
10 3863
.... how can a method be sealed (you cannot override it any further) and
abstract (you must override it) ? It's a contradiction.

If the interviewer was not mentioning ,and you misunderstood , the
combination of sealed override (which is the only way to apply sealed
in a method) then he was one of the usual managers.

Tasos

May 20 '06 #2
TJM
Tasos,

I am sure I did not misunderstand because I gave the same argument as you
did. But he insisted that this is possible!

TJM

"Tasos Vogiatzoglou" <tv*****@gmail. com> wrote in message
news:11******** *************@i 40g2000cwc.goog legroups.com...
... how can a method be sealed (you cannot override it any further) and
abstract (you must override it) ? It's a contradiction.

If the interviewer was not mentioning ,and you misunderstood , the
combination of sealed override (which is the only way to apply sealed
in a method) then he was one of the usual managers.

Tasos

May 20 '06 #3
Be happy then if they don't offer you a position. :) The guy was the
typical manager in the typical company :)

Tasos

May 20 '06 #4
He wan't talking about classes , right ?

May 20 '06 #5
Because even if MSDN states that, it's a valid MSIL construct in .net 2
to enable static classes ... But for methods it's not valid.

May 20 '06 #6
A note ... if the guy was talking about classes in .NET 2 then he is
right in a case (altough it's kind of stupid to ask such a question
because it's a tiny detail).

I think that it is a custom in interviews to ask far-fetched questions
just to bring the candidate to a difficult position.

May 20 '06 #7
On Sat, 20 May 2006 10:23:14 -0400, "TJM" <tm******@cybiz .com> wrote:
Tasos,

I am sure I did not misunderstand because I gave the same argument as you
did. But he insisted that this is possible!

TJM

"Tasos Vogiatzoglou" <tv*****@gmail. com> wrote in message
news:11******* **************@ i40g2000cwc.goo glegroups.com.. .
... how can a method be sealed (you cannot override it any further) and
abstract (you must override it) ? It's a contradiction.

If the interviewer was not mentioning ,and you misunderstood , the
combination of sealed override (which is the only way to apply sealed
in a method) then he was one of the usual managers.

Tasos


You can't create a sealed abstract class yourself, but I've heard that
the C# compiler compiles static classes as sealed abstract
somewhere... is that possible?

In the beta the was such a thing as sealed abstract :)
http://www.agiledeveloper.com/blog/P...d0d7e201e.aspx


--
Ludwig Stuyck
http://www.coders-lab.be
May 20 '06 #8
That's the fact. But it's down to MSIL (regarding C# compilation) ... I
don't know if it can happen to other languages .

May 20 '06 #9
TJM

Do you mean that it is possible to have a static abstract sealed class?
And if yes, what is it used for?

"Tasos Vogiatzoglou" <tv*****@gmail. com> wrote in message
news:11******** **************@ j73g2000cwa.goo glegroups.com.. .
Because even if MSDN states that, it's a valid MSIL construct in .net 2
to enable static classes ... But for methods it's not valid.

May 20 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1114
by: Wayne Phipps | last post by:
I'm trying to get my head around objects and am asking for thoughts on this idea. If for example I were to implement a Person Object, there may be differnt Person objects representing people of different cultures. All Person objects have similar characteristics, ie Height, Weight, Age ect but I imagine that there could be a method ie SayHello which Person objects of different cultures would implement differently.
33
3333
by: Chris Capel | last post by:
What is the rationale behind the decision not to allow abstract static class members? It doesn't seem like it's a logically contradictory concept, or that the implementation would be difficult or near-impossible. It seems like it would be useful. In fact, there's a place in my code that I could make good use of it. So why not? Chris
14
2929
by: Zeng | last post by:
Would somebody know when we should seal a class? Shouldn't all classes be open up for inheritance? Thanks!
6
3350
by: steve bull | last post by:
I created a usercontrol class, RGBColorSpace, which is derived from an abstract class, ColorSpace, but when I try to click on the design panel for the control I get an error message "Unable to create instance of abstract class ColorSpace". I never try to create a class ColorSpace and don't really want to create a regular class with virtual methods. Does anyone know why I am having this problem? The code seems to run fine and I can actually...
9
8403
by: Kylin | last post by:
any better reason ? -- FireCrow Studio Kylin Garden EMail:gaotianpu@gmail.com ICQ:156134382
2
1130
by: 0to60 | last post by:
I have a base class that defines a property. I'd like the the Get to be implemented by the base class and not overrideable. I would like the Set to be marked abstract, and thus needs to be filled in by overriding classes. Is this possible? What's the syntax?
4
1784
by: Gert Kok | last post by:
The microsoft page http://msdn2.microsoft.com/en-us/library/9fkccyh4.aspx states: Remarks (nr 4) Virtual properties behave like abstract methods, except for the differences in declaration and invocation syntax.
18
2947
by: Vedo | last post by:
ref struct XXX abstract sealed { literal int A = 5; }; The definition above gives me the compiler warning "C4693: a sealed abstract class cannot have any instance members 'A'". The equivalent definition is perfectly legal in other CLR languages. For example in C#; static class XXX
8
1718
by: puzzlecracker | last post by:
0) What is the convention name for derived classes? 1) If we implement methods in abstract class, do we still need to declare them as abstract? 2) Are we allowed to override methods in derived classes that are already implemented in abstract? 3) Are there a different accessibility levels when I inherit class, like (public, protected, private), like class A:public B? Thanks
0
8382
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8498
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1600
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.