Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6000747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:44:17+00:00 2026-05-23T00:44:17+00:00

I have found for self is very interesting a fact. For example i’ve wrote:

  • 0

I have found for self is very interesting a fact. For example i’ve wrote:

type A = { val st: Set[Any]
           val start: Set[Any]
           val Sigma : Set[Char]
           def tr(f: (Tuple2[Any, Any])=>Boolean): Set[Any]
             }
class Fon {
          val st: Set[Any]
          val start: Set[Any]
          val Sigma : Set[Char]
          def tr(f: (Tuple2[Any, Any])=>Boolean): Set[Any] = Set(out)
          def out: String = "is just example"
}
val a: A = new Fon
a.tr(f(Tuple2('a',0)))

But if i will try do call a.out – i get an error, that the type A have not exist ‘out’
What happening to this, how this to work?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:44:18+00:00Added an answer on May 23, 2026 at 12:44 am

    There is no such method as A.out, because of how you’ve defined the A type. Thus, when you try to call a method called out on an object of type A, the compiler correctly tells you that no such method exists.

    This is not related to structural typing, by the way – if you had made A a trait and had Fon extend it, you’d run into exactly the same problems. Moreover, this is just how static typing systems work – the compiler can’t guarantee that your code is typesafe so it won’t compile it.

    If you want to call the out method, then you’ll need to refer to that object via a Fon variable:

    val a: Fon = new Fon
    println(a.out) // works fine, since a is guaranteed to be a Fon and thus have the method
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found that my HTML is, to be honest, very clunky. Small, simple
I have found that there is generally a singe type or namespace that takes
I have found an interesting issue in windows which allows me to cause the
I have found ASP.Net PageMethods very handy and easy to use, but I have
I have found C++ FQA Lite very edificatory and would like to read more
I have a scenario that i suspect is very common, i've found various ideas
This is probably a very basic question but I haven't found any detailed information
We have found that we have a set of attributes(all are not going to
I have a very straight forward class with mostly NSString type properties. In it,
I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.