投稿数 - 437, コメント - 53055, トラックバック - 156

internal sealed

クラスライブラリのような物ではなく、末端アプリケーションを開発するとき気になる事。internal と sealed。C# の話であり、VB.NET ならば、Friend と NotInheritable。

末端アプリケーションならば外部から参照される事がないので、殆ど全てのクラスが internal になり、多くのクラスは sealed になる。
私はイチイチこれらのキーワードを付けるようにしているのだが、他の多くの開発者はどうしているのだろう。
一緒に仕事している人は付けない傾向が多いような気がする。どっちにしろ外部から使われる用途でないのだから、そんな区別も必要ないということだろうか。確かにそんな気もする。

同じように気になるのが、オーバーライドするネタがあるクラスを継承し、派生クラスが sealed になるケース。例えば、

internal abstract class A
{
  public abstract void a();
}
internal sealed class B : A
{
  public override void a(){}
}

こんなケース。このとき、B の a() を記述するときに

public sealed override void a(){}

こうすべきかどうか迷う。

同じように internal なクラスに public メンバ?とも迷う。internal なクラスのメンバは最高でも internal にしか制限を弛められないから、public メンバは変に思える。
しかし、私は public にするようにしている。クラスの制限が変更になっとき面倒だからだ。

さらに、抽象クラスのコンストラクタ。public にしようか protected にしようか迷う。どうせインスタンス化できないのだから、public にしても問題ないが、意味的には protected なので protected と書くようにしているが。

投稿日時 : 2005年11月12日 16:16

フィードバック

# re: internal sealed

 わはは…付けていませんねぇ。

 例えば、外部に販売するアプリケーションを作るようになったら、注意すると思います。内部でしか使わないアプリケーションだから、特に注意していない……うそっぷ!作り始めたときに知らなかった(ベースは C++ なもんで)から、全部直すのが面倒なので使っていない!!
2005/11/14 21:08 | Jitta

# re: internal sealed

> さらに、抽象クラスのコンストラクタ。
> public にしようか protected にしようか迷う。

これは protected とすべきですよね。

ところで、エントリ ポイント、C# は private と書くことができるのに、VB は Protected 以上のアクセス修飾子でないといけないのは何故なんだろう...
2005/11/15 7:30 | じゃんぬ

# re: internal sealed

>全部直すのが面倒なので使っていない!!
使わなくても問題ないってのが面倒さに拍車をかけますよね。本当面倒になってきた・・・。

>これは protected とすべきですよね。
ですよね。ヘルプに出した時自然に見えますし。

>ところで、エントリ ポイント、C# は private と書くことができるのに、VB は Protected 以上のアクセス修飾子でないといけないのは何故なんだろう...

VB の仕様の方が理に適っているような気がします。
というより、何で public じゃなくていいのよ?と思います。
エントリポイントは「公開」って感じがするんですけどねぇ。

2005/11/15 9:13 | 囚人

# re: internal sealed

エントリ ポイントは特別なものであるという意図でしょうか。
VB が protected OK なのもかなりの違和感が...
2005/11/16 9:45 | じゃんぬ

# re: internal sealed

>VB が protected OK なのもかなりの違和感が...

確かに、protected で OK は何か中途半端な気がして違和感ありますねー。public だけ!ってんなら納得なんですが・・・。
2005/11/16 18:54 | 囚人

# re: internal sealed

概念的には Friend (internal) からかなぁ。
2005 ではどうなってるんでしょうね。

マダ 2005 サワッタコトナイノデス...
MVP シッカク... orz
2005/11/17 12:10 | じゃんぬ

# オーバーライド可能なメソッドのないクラスはシールにすべきか

オーバーライド可能なメソッドのないクラスはシールにすべきか
2006/03/13 13:15 | 囚人のジレンマな日々

# re: internal sealed

i can't speak Japanese
2010/04/28 12:14 | funtens

# HRyjivsDQnUkj

LJ4dUy Fantastic blog post. Really Great.
2014/08/04 4:37 | http://crorkz.com/

# EYELlXlOTMAVrMh

vJU27n http://www.FyLitCl7Pf7kjQdDUOLQOuaxTXbj5iNG.com
2015/01/12 7:41 | varlog

# yZuTefhyqCAVhOtM

Did you go to university? http://www.cleanenergyconsultancy.co.uk/training/workshops/ buy zopiclone 7.5 mg online We all loved what Wes did in NE. But let’s be realistic. Wes was not the smartest player out there … as evidenced by his fumbled punt return within the 10 yard line for Denver. He’s also been prone to dropping key catches. Which he has done for Denver, but lucked out that no one called for a review of that catch.
2015/01/28 10:33 | Willie

# TwvtYJrCsvdxqT

The National Gallery http://www.cleanenergyconsultancy.co.uk/training/workshops/ is 3.75 mg zopiclone enough Moon said recent more positive news about the economy � including modest falls in employment, signs of an improvement in the housing market and stronger-than-expected GDP growth of 0.7% in the second quarter � had probably boosted consumers' mood.
2015/01/28 10:33 | Gaylord

# iwHwaXfWGmOVMRo

It's funny goodluck http://www.webface.ie/our-advantages.html imovane online uk Another former board member, John Biggs, called those pushing for a vote �spiteful and narrow.� He added, �Why should shareholders, who�ve been rewarded handsomely by what�s happened under Dimon, why should they come and say, �Well, we know better than you�?�
2015/01/28 10:34 | Boyce

# UWQzeWZHae

Gloomy tales http://www.blue-lemons.com/about order levofloxacin online Under Durbin's law, federal COPS grant funds would be distributed based off of the percentage of crime guns police officials submit into the database each year. But, pro gun groups like the National Rifle Association say Durbin's bill is a "solution in search of a problem." And in an era when resources are scare, groups argue Durbin should leave law enforcement to decide when a gun needs to be traced and when it doesn't.
2015/02/06 8:14 | Wilfred

# oLDxPEDgiVevftVAwsf

Have you got any experience? http://dinbox.se/nedladdning/ equity loans rate Global miner Rio Tinto scrapped plans tosell its loss-making Pacific Aluminium business in a sign oftough market conditions facing the miner, which is trying tooffload underperforming assets during an industry downturn.
2015/02/06 19:30 | Claude

# vrayKCJJqFxlBodxqVc

The manager http://dinbox.se/nedladdning/ atm cash advance Verlander now has thrown 30 consecutive scoreless innings against the Athletics over the past two postseasons, a record for one pitcher against one team, according to the numbers experts at the Elias Sports Bureau.
2015/02/06 19:31 | Buddy

# xbtLSyAKKcd

Very funny pictures http://dinbox.se/nedladdning/ www loans for bad credit com So rather than waiting for educational institutions, corporations have the power to begin taking these vital steps immediately. It is simply a matter of priorities. Once the big brands realize that continuing to fill our heads with junk will be their downfall, we will see a big change in all the media around us influencing us throughout the day.
2015/02/06 19:31 | Virgilio

# vBCyLgfKqrtgXAQP

Yes, I love it! http://www.green-events.co.uk/about.html Vytorin Gel Many animal species consist of members that will only mate once before dying. This reproductive strategy, often seen in fish and insects, can make evolutionary sense when the species is able to produce a lot of offspring from that single mating. Given that salmon can release thousands of eggs when they spawn, a single mating can produce a lifetime's worth of offspring.
2015/02/08 16:10 | Garret

# sLDBpvfkZKutBPc

The manager http://www.sporttaplalkozas.com/sporttaplalkozas/eletmod-program installment loans help credit "So I do believe we should cut out programs that we don't need. We need to fix ones that aren't working the way they're supposed to or have outlived their initial mission. We've got to make the government faster and more efficient."
2015/02/09 13:03 | Nicky

# IHUomqnCSjWVbuIxd

Remove card http://www.sporttaplalkozas.com/sporttaplalkozas/esg crisis loan form AMR is scheduled to present its restructuring plan to Judge Sean Lane in U.S. Bankruptcy Court in Manhattan on Thursday for final approval. In theory, Lane could approve the plan, contingent on the merger going ahead. But experts said the judge is more likely to impose some sort of delay.
2015/02/09 13:03 | Merle

# BaSLbLudqTOTyhYv

Your account's overdrawn http://www.globalbersih.org/about-us/ online loans in colorado Some investors argue that Apple's hold on a market itcreated is likely to slip as rival smartphone makers as well asGoogle and Amazon.com Inc pile in, but Cook noted thatusage data shows the iPad still commands a dominant share of Webtraffic.
2015/02/10 21:05 | Raymond

# IMWYkWZDMQywccvnSIO

Canada>Canada http://www.testwall.com/products/ Order Fenofibrate Online Another person familiar with the matter said earlier this month that Twitter aimed for its shares to trade in the stock market before the U.S. holiday of Thanksgiving on November 28, a timeline also reported by Quartz on Sunday.
2015/02/11 1:16 | Bailey

# ySoZqYyTNXrWgnFlZjC

Do you need a work permit? http://broadcastmedia.co.uk/communications-training Order Famciclovir "Household spending and business fixed investment advanced, and the housing sector has been strengthening, but mortgage rates have risen somewhat and fiscal policy is restraining economic growth," the Fed said.
2015/02/11 1:16 | Darius

# mVllziQdCd

We used to work together http://esuf.org/events-2/ secured loan for bad credit "It is not a full instrument landing. You have to visuallyfly into that runway," he said. "Sometimes it takes nuance toland there. You have to realize that hill is there or you couldcome in too low."
2015/02/12 5:43 | Jefferey

# vSqRFQtgnEf

I live here http://thisisaway.org/get-involved/ ez pay day loans "Bavarians are experienced when it comes to scandals andjust don't view them as all that bad," said Manfred Guellner,head of the Forsa polling institute. "It's apparently acceptableas long as the state is doing well."
2015/02/12 5:43 | Everett

# HpaqZUhXYkx

Some First Class stamps http://www.streamsweden.com/support/ inderal cost The European Commission has 25 working days after a deal is filed for a first-stage review. It may extend that by 10 workingdays to 35 working days, to consider either a company's proposedremedies or an EU member state's request to handle the case.
2015/02/24 23:20 | Darius

# tPSblpCUaWHS

What are the hours of work? https://rarcc.org/contact-us buying bimatoprost in usa It has filed six friend-of-the-court briefs in the California Supreme Court this year, compared with five such briefs for all of 2012, and three in New York's highest court, the Court of Appeals, compared with none in 2012.
2015/02/28 16:31 | Toney

# lJTjpAlnKkjM

Recorded Delivery http://www.europanova.eu/category/actualite/ odå¼ywki z bimatoprostem Azeri state oil company SOCAR and the French oil companyeach hold 40 percent of the project to develop Absheron, ashallow-water offshore field on the Caspian Sea, underproduction-sharing agreements. The remainder is held by GDF Suez.
2015/02/28 16:31 | Connie

# eEztkGxYVhOsV

I'll text you later https://rarcc.org/contact-us bimatoprost without a presciption The document warns that Conservatives are still performing "indifferently" outside the South East, with around half of parliamentary seats in the Midlands, a third in the North and just one in Scotland.
2015/02/28 16:31 | Santo

# yjiIwfedkxjPaHpC

The manager http://www.streamsweden.com/tjanster/ propranolol price in india Nelson Cruz was greeted with a standing ovation by a towel-waving crowd in Texas during the Rangers' one-game playoff with the Rays two weeks ago, while Jhonny Peralta was given a hero's welcome when he made his return to the Tigers at Comerica Park during last week's ALDS.
2015/04/07 5:59 | Sandy

# VvubqHLjdsxTuF

I live here http://www.europanova.eu/partenaires/ latisse generic J&J over the past three years has recalled dozens of OTCproducts made at its plants in Pennsylvania and Puerto Rico thatwere shown to have foreign particles or incorrect concentrationsof active ingredients. Costly plant upgrades are still underway, as J&J strives to make the affected products at otherplants.
2015/04/08 7:14 | Barry

# kGGDlThZeaBbKsY

Please call back later http://www.europanova.eu/contact/ no prescription bimatoprost fedex delivery The shutdown, said Jim Knowlton, 46, from Massachusetts, is what �the Founding Fathers envisioned.� Looking to become more engaged in Republican politics after a recent layoff, Knowlton said both sides need to compromise, and if a shutdown is the only way to force a compromise, that�s how it should be. In the interim, Knowlton is OK with a compromise on the issue of Obamacare, as long as the goal remains to repeal the law in the long term. He predicts Obamacare will go the way of other �laws of the land� that have been repealed, like �prohibition� and �slavery.�
2015/04/08 7:14 | Chris

# HwQGOLvdiEHAJpCec

Languages http://www.europanova.eu/tag/stage/ lumigan buy online Some 70 per cent of the 206 GPs questioned also said that patients are likely to face longer waiting times because resources are stretched, while 47 per cent said they have already been forced to make cut backs.
2015/04/08 7:14 | Toney

# ARfNkeyteCjtPD

ALDVPo http://www.FyLitCl7Pf7kjQdDUOLQOuaxTXbj5iNG.com
2015/05/01 6:38 | chaba

# sPXsXOwwlp

Very funny pictures http://www.ctahperd.org/about-us.html erexin-v review The criminal investigation has looked at, among other issues, whether traders painted the tape, a form of market manipulation that allows them to inflate the value of their positions, three of the people said at the time.
2015/05/19 10:02 | Grant

# VBZKlbKOPFQe

I can't stand football http://www.ctahperd.org/about-us.html erexin-v online I don’t understand how downsizing a whole 2 cylinders makes that much of a difference in efficiency. What’s next? 5 years, a twin-turbo I-4 block? 10 years, a hybrid gas-electric power-plant? 15 years, all electric or solar? 20 years, Fred Flintstone?
2015/05/19 10:02 | Fifa55

# zvmtbptTajjPUBH

I'm unemployed http://www.aslan.ie/biography/ intagra tablets pills 50 mg Women's fashion accessory and apparel maker Francesca's, whichtargets the female 18-to-35 demographic, missed on the ZacksConsensus Estimate today and lowered third quarter guidance. Samestore sales fell 1% in the second quarter. Like the teen retailers,it said traffic was weak, especially in July, and remained so intoAugust.
2015/05/19 10:02 | Roosevelt

# wholesale love bangle pink gold

Sounds like you have all saved me from a lot of headaches. I have had a call this afternoon from our head office, saying there was a call I had to respond to ASAP from Public Sector and call is urgent etc, etc. So before I called them back (silly me) I did a web search and surprise, surprise, you all saved my bacon. Many Thanks
wholesale love bangle pink gold http://www.lovebangles.org/category/cartier-love-bracelet-gold-plated-replica

# how much is the fake rolex lady blue watch

Detta sätter media i fokus för ett beteende som ALLA vet om.
how much is the fake rolex lady blue watch http://www.crownuhr.nl/rolex-datejust-ii-41mm-watch-fluted-bezel-black-roman-index-dial-116334bkrio-p58/
2017/07/08 4:56 | dewtxzcxefsnfugpyj@hotmal.com

コメントの投稿

タイトル
名前
URL
コメント