class myBaseClass def funcTest() puts "baseClass" endendmyBaseClass.new.funcTestI am getting an error:

NameError: undefined local variable or technique `myBaseClass" because that main:Objectfrom c:/Users/Yurt/Documents/ruby/polymorphismTest.rb:9from (irb):145:in `eval"from (irb):145from c:/Ruby192/bin/irb:12:in `"irb(main):152:0> x=myBaseClass.newWhen i tryx=myBaseClass.new, i get:

NameError: undefined local variable or technique `myBaseClass" for main:Object from (irb):152Has someone already encountered this problem? i don"t think my code deserve to be wrong.

You are watching: Class/module name must be constant


*

*

In ruby, every constants including course names must begin with a resources letter. MyBaseClass would be understood as one undefined local variable. MyBaseClass would occupational properly.


*

Your class name should start with a capital, functioning code below

class MyBaseClass def funcTest() puts "baseClass" endendMyBaseClass.new.funcTest

*

*

Your password is wrong. Classnames should start with an uppercase in Ruby.

class MyBaseClassfixes it.

What ns don"t obtain is exactly how you don"t get a clean error article like i do.


Thanks for contributing solution to ridge Overflow!

Please be sure to answer the question. Administer details and also share your research!

But avoid

Asking because that help, clarification, or responding to other answers.Making statements based upon opinion; earlier them increase with references or personal experience.

See more: First Inauguration Of Barack Obama Inaugural Ball Dance At Inaugural Ball

To discover more, watch our tips on writing good answers.


article Your answer Discard

By click “Post her Answer”, you agree come our terms of service, privacy policy and cookie plan


Not the prize you're looking for? Browse various other questions tagged ruby course or ask your very own question.


site architecture / logo © 2021 ridge Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.9.27.40309


her privacy

By clicking “Accept every cookies”, you agree stack Exchange can store cookies on your an equipment and disclose information in accordance v our Cookie Policy.