じゃんぬねっと Blog

しょーもない日記

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  983  : 記事  4  : コメント  22178  : トラックバック  277

ニュース

My Website

初心者向けのサイトです。

C# と VB.NET の入門サイト

最近のできごと

年収がもうすぐ 4 桁万円 (残業はありません)。技術、コンサルに自信ある人は連絡して。


最高の配偶者、可愛い娘、ハンサムな息子と幸せな日々を送っています。



ゴリラ?そんなの飼っていません!

Sponsored Link1

Sponsored Link2

Archive

書庫

VB.NET の MeMyClassMyBase 違い、皆さんはご存知ですよね? 先日、講義をやらさせて頂いた時に、MyBase はともかく、MeMyClass の違いについてご存知の方が意外と少ないという事実を知りました。

違いを実証するためには、以下のようなクラスを書きます。

VB.NET - Me、MyClass、MyBase の違いを実証するための基底クラス

'/** 基底クラス */
Public Class BaseClass
    Protected Overridable Function GetString() As String
        Return "BaseClass.GetString()"
    End Function

    ' テストとして呼ばれるメソッド
    Public Sub BaseClassMethod()
        System.Console.WriteLine(Me.GetString())
        System.Console.WriteLine(MyClass.GetString())
    End Sub
End Class

VB.NET - Me、MyClass、MyBase の違いを実証するための継承クラス

'/** 継承されたクラス */
Public Class ExtendsClass
    Inherits BaseClass

    ' GetString メソッドをオーバーライド
    Protected Overrides Function GetString() As String
        Return "ExtendsClass.GetString()"
    End Function

    ' テストとして呼ばれるメソッド
    Public Sub ExtendsClassMethod()
        System.Console.WriteLine(Me.GetString())
        System.Console.WriteLine(MyClass.GetString())
        System.Console.WriteLine(MyBase.GetString())
    End Sub
End Class

では、テスト用のメソッドを呼んでみましょう。

VB.NET - Me、MyClass、MyBase の違いを実証するためのテスト コード

' テスト用のメソッド
Private Shared Sub ExecuteTest()
    Dim instance As New ExtendsClass()

    instance.ExtendsClassMethod()  ' 継承クラスのメソッドを呼び出す
    instance.BaseClassMethod()     ' 基底クラスのメソッドを呼び出す
End Sub

Me からメンバを呼び出した場合は、呼び出した場所がどこであれインスタンスが示すクラスにあるメソッドを呼び出します。MyClass からメンバを呼び出した場合は、インスタンスの型が何であれ呼び出したクラスにあるメソッドを呼び出します。

説明不要だとは思いますが、MyBase は、そのインスタンスが示す型のひとつ上の基底クラスを指します。今回の場合、ExtendsClass の MyBase は BaseClass になります。

よって、結果は、

VB.NET - ExtendsClassMethod メソッドの呼び出し

  • ExtendsClass.GetString()
  • ExtendsClass.GetString()
  • BaseClass.GetString()

VB.NET - BaseClassMethod メソッドの呼び出し

  • ExtendsClass.GetString()
  • BaseClass.GetString()

になります。

投稿日時 : 2006年11月9日 11:33

コメント

# re: VB.NET の Me、MyClass、MyBase の違い 2006/11/10 11:14 R・田中一郎
この違いを完全に理解して使いこなせたとしても、やっぱり後から見ると訳が分からなくなりそうです。

VB.NET で書くことは、あまり無いとは思うのですが、仮にあったとして MyClass は使わないようにしたいなぁ、などと思ってみたり^^;

# re: VB.NET の Me、MyClass、MyBase の違い 2006/11/10 12:10 always29
こんにちは。

これ、面白いですね。
BaseClassとExtendsClassの間に、MiddleRankClassとかかますと、そこではMe、MyClass、MyBaseが、それぞれ違うクラスを示すことを、よりくっきり説明できますね。
Meを使う上での注意点や、基底クラスからインスタンスクラスのメソッドが呼べることが、よくわかります。

# re: VB.NET の Me、MyClass、MyBase の違い 2006/11/10 16:47 じゃんぬ
MyBase は、流石に知られているので省略しました。
すべての違いを説明する予定で加えましたが、MyBase は、MyClass と違ってややこしくはないので、言葉で説明するだけに変えさせて頂いています。

# re: VB.NET の Me、MyClass、MyBase の違い 2008/05/26 16:47 そなんだ
そなんだ。
でも、あまり使わないですね。

# tLPesngiHfD 2014/07/18 21:14 http://crorkz.com/
tIyEJt Great, thanks for sharing this blog post. Really Great.

# GsxOjADmQvzJmxGq 2014/09/08 23:00 https://www.youtube.com/watch?v=mSbbytrVLHY
you've got an incredible blog here! would you prefer to make some invite posts on my weblog?

# JxDkBCWGYEkKvgqEg 2014/09/18 15:57 http://madisonmotherlove.info/story.php?id=33309
IvPm8v I truly appreciate this blog.Much thanks again. Will read on...

# wrYjDYHLMVGZGHBQSX 2015/04/19 3:25 sally
nDmN7E http://www.FyLitCl7Pf7kjQdDUOLQOuaxTXbj5iNG.com

# cfxrvdfugnv@docomo.ne.jp 2017/06/26 15:33 長財布 ブランド激安 コピー
日本的な人気と信頼を得ています
当社の商品は絶対の自信が御座います
スタイルが多い、品質がよい、価格が低い!
迅速、確実にお客様の手元にお届け致します
実物写真、付属品を完備しております
ご注文を期待しています!

# fhoqxjzp@softbank.jp 2017/09/21 4:25 人気ブランド
注文した翌日には届きました!
Aランクとのことでしたが新品みたいでした!
大満足です!
散々悩んでコチラで購入を決めたかいがありました。
また機会があれば利用します!
人気ブランド http://www.copysale.net

# QoCbgDMkuPPFrIeQ 2018/10/13 21:52 https://www.suba.me/
9GTo0f I went over this website and I believe you have a lot of good info , saved to bookmarks (:.

# ipnBdhFZqWT 2018/10/15 17:38 https://www.youtube.com/watch?v=wt3ijxXafUM
we could greatly benefit from each other. If you are interested feel free

# tigdjSMoJrnEzDkZT 2018/10/15 23:55 https://www.acusmatica.net/cursos-produccion-music
to shoot me an email. I look forward to hearing from you!

# PwytVHcszgjojEYyX 2018/10/16 8:40 https://www.hamptonbaylightingcatalogue.net
qui se retrouve et son petit cul les hommes

# tCyYnduKmIyFv 2018/10/16 10:51 https://www.youtube.com/watch?v=yBvJU16l454
I?аАТ?а?а?ll right away snatch your rss as I can at to find your email subscription link or newsletter service. Do you have any? Kindly let me understand in order that I may just subscribe. Thanks.

# SkVBYfeJcflsDZX 2018/10/16 14:33 https://randomflower7.blogfa.cc/2018/10/13/the-mos
Perfect work you have done, this site is really cool with great information.

Once We came up to this short article I may only see part of it, is this specific my internet browser or the world wide web website? Should We reboot?

# RyhzXDxMWIflQRhqRA 2018/10/16 17:48 https://tinyurl.com/ybsc8f7a
We all speak a little about what you should speak about when is shows correspondence to simply because Maybe this has more than one meaning.

# oJrBQKYhIJM 2018/10/16 19:48 http://www.magcloud.com/user/camelslave1
Wow, incredible weblog format! How lengthy are you currently blogging pertaining to? you made blogging glimpse easy. The full look of your respective website is excellent, let alone the content!

# tXLafGedqPzDwGwjD 2018/10/16 22:23 http://chris3.com/__media__/js/netsoltrademark.php
Suspendisse viverra, mauris vel auctor fringilla

# PEPDPGgqFOatTyTFyS 2018/10/17 0:30 http://www.aim-investment.biz/__media__/js/netsolt
I visit daily some blogs and information sites to read articles

# gpnvxHlWbcFdH 2018/10/17 10:30 https://www.youtube.com/watch?v=vrmS_iy9wZw
Relaxing on the beach with hubby. Home in both cities where my son as live.

# jfBdfPfWwCeA 2018/10/17 12:28 https://plus.google.com/109597097130052772910/post
What would be There?s noticeably a bundle to find out about this. I assume you made certain good points in features also.

# DfFhwqJRpUFtkYMMmsM 2018/10/17 15:51 http://articles.al.lv/article/49994/Are-looking-fo
You made some decent points there. I looked on the internet for the subject matter and found most people will approve with your website.

You ave made some good points there. I checked on the web for additional information about the issue and found most individuals will go along with your views on this website.

# GoxOriGaYOvPmtG 2018/10/17 21:08 https://penzu.com/public/27eebcbb
Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, as well as the content!

# DDcjMFQrRznaiWzpotQ 2018/10/17 22:51 https://medium.com/@BaileyGuerard/excellent-forms-
This website was how do I say it? Relevant!! Finally I have found something which helped me. Thanks!

# oeffmOyggj 2018/10/18 9:46 https://myliemorrison.yolasite.com/
Major thankies for the blog.Thanks Again. Really Great.

# BIJIycVpxWVCVBE 2018/10/18 12:03 https://www.youtube.com/watch?v=bG4urpkt3lw
It as nearly impossible to find well-informed people for this topic, however, you sound like you know what you are talking about! Thanks

# cIEajLLpVcM 2018/10/19 15:00 https://www.youtube.com/watch?v=fu2azEplTFE
I went over this internet site and I believe you have a lot of good information, saved to my bookmarks (:.

# lpTwxHzgwcMArVO 2018/10/19 16:44 https://place4print.com/custom-embroidery/
i use google when i want to do some spanish translation, it is good for general spanish translation.,

# zNyaahZehzAUq 2018/10/19 19:23 https://usefultunde.com
wow, awesome article post.Really looking forward to read more. Really Great.

# dBJverjbfMzNRP 2018/10/19 23:05 http://tasbbs.com/home.php?mod=space&uid=11800
Thanks for another wonderful article. Where else could anybody get that type of info in such an ideal way of writing? I ave a presentation next week, and I am on the look for such information.

# wgWyGPXEEXlJ 2018/10/20 2:42 https://propertyforsalecostadelsolspain.com
You have made some good points there. I checked on the internet for additional information about the issue and found most people will go along with your views on this site.

# yEOAiUuUgQUilGV 2018/10/20 6:14 https://www.youtube.com/watch?v=PKDq14NhKF8
It seems too complicated and extremely broad for me. I am looking forward

# zITclJgnMfwHQ 2018/10/22 22:38 https://www.youtube.com/watch?v=yWBumLmugyM
This page really has all of the info I needed concerning this subject and didn at know who to ask.

# ASaOeRbiqCmvgUD 2018/10/23 0:24 https://www.youtube.com/watch?v=3ogLyeWZEV4
You have made some really good points there. I looked on the internet for more information about the issue and found most people will go along with your views on this website.

# zqmYjqvxWdz 2018/10/24 23:25 http://adep.kg/user/quetriecurath804/
It'а?s really a great and helpful piece of information. I'а?m satisfied that you just shared this useful information with us. Please stay us informed like this. Thanks for sharing.

You are my inspiration , I have few blogs and rarely run out from to brand.

Really appreciate you sharing this post.Really looking forward to read more. Awesome.

# HBkJeVRrcMOhqxh 2018/10/25 11:59 http://sport.sc/users/dwerlidly164
This info is invaluable. Where can I find out more?

# lFzkPrKJjKNdugC 2018/10/25 23:06 http://forum.goldenantler.ca/home.php?mod=space&am
This blog was how do I say it? Relevant!! Finally I ave found something which helped me. Appreciate it!

# AvpExXwiRC 2018/10/26 19:47 https://www.youtube.com/watch?v=PKDq14NhKF8
Superb post here, thought I could learn more from but we can learn more from this post.

# ylvEbbbTjJtV 2018/10/27 0:40 https://www.facebook.com/applesofficial/
Im obliged for the article post.Really looking forward to read more.

# IQduOxswvGTNDHj 2018/10/27 8:08 http://danielsunjata.net/__media__/js/netsoltradem
Im thankful for the blog article.Really looking forward to read more.

# OqxOXeoZdXgIrpfiD 2018/10/27 17:56 http://tvtalent.org.uk/UserProfile/tabid/95/UserID
Really enjoyed this article post.Thanks Again. Really Great.

# loxnjLEmJHZc 2018/10/28 1:41 http://funny-forum.today/story.php?id=1181
You have brought up a very wonderful details , appreciate it for the post.

# MDtSVKrvJawdTirumV 2018/10/28 7:18 https://nightwatchng.com/about-us/
placing the other person as webpage link on your page at suitable place and other person will also do similar in favor of

# xbITtfMckZmz 2018/10/28 12:47 http://prodonetsk.com/users/SottomFautt900
Im obliged for the blog.Much thanks again. Keep writing.

# SFCZMkQSOvFnKufAEoT 2018/10/30 5:50 https://betadeals.com.ng/user/profile/1210263
Very informative blog post. Keep writing.

# XvWjnaXLlZwZmiRA 2018/10/30 11:14 https://psychotherapy6.site123.me/
Your style is unique compared to other folks I ave read stuff from. I appreciate you for posting when you ave got the opportunity, Guess I all just book mark this blog.

# ksIlzWvcSMMTjTgVX 2018/10/31 3:07 http://diveconnect.com/blog/view/27674/cost-effect
Very informative post.Much thanks again. Keep writing.

# OGjfkeFkyFVRCQhQqz 2018/10/31 15:39 http://vasilkov.info/in.php?link=http://b.augustam
I'а?ve read a few excellent stuff here. Definitely price bookmarking for revisiting. I surprise how so much effort you place to make this kind of magnificent informative web site.

# KSllvMQeflCq 2018/11/01 18:51 https://www.youtube.com/watch?v=3ogLyeWZEV4
Whats Happening i am new to this, I stumbled upon this I have found It positively useful and it has aided me out loads. I hope to give a contribution & help other users like its helped me. Good job.

# gHjIMKtAEAfkrty 2018/11/02 1:09 https://kesterwong-73.webself.net/
This is a topic which is close to my heart Cheers! Where are your contact details though?

# AobISzvLzDXqw 2018/11/02 3:56 http://dylanhiggs.strikingly.com/
You ave made some really good points there. I checked on the web to find out more about the issue and found most individuals will go along with your views on this website.

# lqnZJSbsKyMjmE 2018/11/02 9:28 http://all4webs.com/liquidwar4/wixzvrocki592.htm
Informative article, totally what I needed.

# nKoFUERalNDbdgXa 2018/11/02 17:49 http://oceancollins.bravesites.com/
Outstanding post, I conceive people should acquire a lot from this weblog its real user friendly. So much fantastic information on here .

# NLDGXYEHryUBQZ 2018/11/03 2:16 https://nightwatchng.com/privacy-policy-2/
produce a good article but what can I say I procrastinate a whole

Your personal stuffs outstanding. At all times handle it up!

# maaiOaiUZHYy 2018/11/03 12:59 https://www.evernote.com/client/snv?noteGuid=62374
Inspiring quest there. What occurred after? Thanks!

# ECZitqJdqALf 2018/11/03 16:36 http://www.armandroussoblog.com/ceiling-fans-these
Lovely site! I am loving it!! Will be back later to read some more. I am taking your feeds also.

# iYgcxSFUtOEccetcwLW 2018/11/03 21:45 http://cercosaceramica.com/index.php?option=com_k2
You have made some decent points there. I checked on the internet for more information about the issue and found most people will go along with your views on this site.|

# bZngOKJGFjLPHKuUV 2018/11/03 22:27 https://www.momsake.com/
Very good write-up. I certainly appreciate this site. Stick with it!

# IQsubLEDOnZSSTkv 2018/11/04 6:07 http://all4webs.com/indiatub2/sbbomcaoak829.htm
Merely wanna input that you have a very decent internet site , I like the style it actually stands out.

# kETORmSrKtkIeey 2018/11/04 9:58 http://chiropractic-chronicles.com/2018/11/01/the-
so I guess I all just sum it up what I wrote and say, I am thoroughly

# csdSRhfftypVYfDtGQG 2018/11/04 12:42 http://bgtopsport.com/user/arerapexign278/
I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks!

# khCzNdddRj 2018/11/05 19:19 https://www.youtube.com/watch?v=vrmS_iy9wZw
Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is magnificent, let alone the content!

# TaPZAhiWmogPlwKOd 2018/11/05 23:29 https://www.youtube.com/watch?v=PKDq14NhKF8
What as Happening i am new to this, I stumbled upon this I ave found It absolutely useful and it has helped me out loads. I hope to contribute & help other users like its aided me. Good job.

# oFRiAzSsNecEYAWIfC 2018/11/06 1:48 http://youkidsandteens.world/story.php?id=1777
Therefore that as why this piece of writing is outstdanding.

Outstanding post however I was wondering if you could write a litte more on this subject? I ad be very grateful if you could elaborate a little bit more. Appreciate it!

# gbmLkJOBuDjIROJT 2018/11/06 13:02 http://thesocialbuster.com/story.php?title=familia
I will immediately snatch your rss feed as I can at in finding your e-mail subscription hyperlink or e-newsletter service. Do you have any? Kindly let me know in order that I could subscribe. Thanks.

# aJksoZxXAdcj 2018/11/06 21:16 http://journaling.clsd.net/talon/staff/
Im thankful for the article.Much thanks again. Awesome.

# uBXdcKfWGyyiyrY 2018/11/07 4:22 http://www.lvonlinehome.com
When I open up your Rss feed it appears to be a ton of garbage, is the problem on my side?

# smzaHQWZMVRHCLvSum 2018/11/07 8:57 http://www.wwegames.net/profile/genia65t957
Wow, amazing blog layout! How lengthy have you ever been blogging for? you make blogging glance easy. The total look of your web site is wonderful, as well as the content material!

# lGzYytsLStmguCxUg 2018/11/07 14:30 https://briangate94.crsblog.org/2018/11/05/remarka
Im obliged for the blog article.Really looking forward to read more. Really Great.

# BFJTBEUPuoRGTlKxc 2018/11/08 2:55 http://www.talmaterials.com/__media__/js/netsoltra
I view something genuinely special in this internet site.

# LAgGiqPYMWHEcfYB 2018/11/08 5:01 http://www.cosl.com.sg/UserProfile/tabid/61/userId
In the meantime, we are not getting new dance pants and are wearing the same mario williams jerseys black dance pants worn before.

# EbTivnwvgkHqwHj 2018/11/08 7:04 http://indianachallenge.net/2018/11/06/gta-san-and
Really informative article.Really looking forward to read more. Want more.

# RCNGZXYgIBOgXoYGGh 2018/11/08 9:10 http://construyendonuestrossuenos.com/how-to-make-
I reckon something really special in this website.

new details about once a week. I subscribed to your Feed as well.

# UOapmpOhRYTy 2018/11/08 15:36 https://torchbankz.com/terms-conditions/
watch out for brussels. I all appreciate if you continue this in future.

# QzlZqjpJwvsTTPM 2018/11/08 16:49 https://chidispalace.com/about-us
Wow, this piece of writing is fastidious, my sister is analyzing these kinds of things, thus I am going to tell her.

# WjAIoOlSxUEuqWvjme 2018/11/08 21:32 https://write.as/spamspamspamspam.md
You can certainly see your skills within the work you write. The arena hopes for even more passionate writers such as you who aren at afraid to say how they believe. All the time go after your heart.

# KbSkBHOVuAQGVzfQFiM 2018/11/09 0:31 https://www.dolmanlaw.com/legal-services/truck-acc
pretty beneficial stuff, overall I think this is really worth a bookmark, thanks

Whats Happening i am new to this, I stumbled upon this I ave discovered It positively useful and it has aided me out loads. I hope to contribute & help different users like its aided me. Good job.

You have brought up a very excellent details , thankyou for the post.

# HYXCubQZIJJte 2018/11/10 4:29 http://forum.onlinefootballmanager.fr/member.php?1
Wow, great article post.Really looking forward to read more. Fantastic.

# yhQzqHwfbCdhtoJ 2018/11/12 17:22 http://bridgejuice1.thesupersuper.com/post/online-
I think this is a real great post.Really looking forward to read more. Awesome.

# LeKhAXaeJNFnxebuW 2018/11/13 2:55 https://www.youtube.com/watch?v=rmLPOPxKDos
Spot on with this write-up, I truly think this website needs much more consideration. IaаАа?б?Т€Т?а?а?аАа?б?Т€Т?аБТ?ll probably be again to learn way more, thanks for that info.

# vPAQfophmtdJWo 2018/11/13 16:29 https://freesound.org/people/ratamount40/
I think this is a real great article post.Thanks Again. Great.

# ehYyoYrjtfhJYO 2018/11/13 16:52 https://namefir5.planeteblog.net/2018/11/11/some-m
you are really a good webmaster. The site loading pace is amazing. It seems that you are doing any unique trick. In addition, The contents are masterpiece. you have done a great task on this matter!

# KdcQVpFQxJKtqfPxv 2018/11/13 21:58 https://reneegoodman.quora.com/Target-Will-Help-Yo
Very informative blog.Really looking forward to read more. Much obliged.

# VBzGihCwoZfq 2018/11/14 21:45 http://digilens.us/__media__/js/netsoltrademark.ph
online. I am going to recommend this blog!

Post Feedback

タイトル
名前
Url:
コメント: