パスワードを忘れた? アカウント作成
452368 journal

Silphireの日記: 今日のぎゃあ 4

日記 by Silphire
見事にハマりました。_| ̄|○

class Foo
  def a
    b
  end
  def b
    print "Foo#b\n"
  end
end
class Bar < Foo
  def b
    print "Bar#b\n"
  end
end
Bar.new.a

$ ruby foo.rb
Bar#b

#include <iostream>
class Foo {
public:
  void a(void){
    b();
  }
  void b(void){
    std::cout << "Foo::b()" << std::endl;
  }
};
class Bar : public Foo {
public:
  void b(void){
    std::cout << "Bar::b()" << std::endl;
  }
};
int main(void)
{
  Bar().a();
  return 0;
}

$ g++ foo.C ; ./a.out
Foo::b()
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

※ただしPHPを除く -- あるAdmin

読み込み中...