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 8103265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:29:35+00:00 2026-06-05T23:29:35+00:00

To explain my question: Class : Toy Trait1: Speak like Male Trait2: Speak like

  • 0

To explain my question:

Class : Toy

Trait1: Speak like Male

Trait2: Speak like Female

Can I change the behavior (traits) of Toy during runtime so sometimes the same object speaks like male and sometimes the same object speaks like female?

I want to change the speaking behavior at runtime.

  • 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-06-05T23:29:38+00:00Added an answer on June 5, 2026 at 11:29 pm

    Scala really doesn’t do that. There’s Kevin Wright’s autoproxy plugin which can do it, and you can instantiate and object with either trait, without that trait being part of the base class.

    I personally think that trying to accomplish things that way is to go against the grain of Scala: hard and prone to getting stuck. It is better to design a solution that doesn’t require such things — in fact, Scala grain tends much more to the functional, which put focus on everything being immutable, and replacing one object with a new one as a result of computation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

-------Now, another question, can anyone explain? class DBFactory { static function create(){ return new
Following on from this question , can someone explain the following in Scala: class
Can anyone explain me the difference of all and also an another question does
Can you explain the next interesting behaviour? class test { //Class *test* has two
I have a question regarding dynamic class initialising, let me explain what I mean:
I'm still pretty new to Cocoa/Objective-C, so I hope I can explain my question.
This demo class to explain the question public class SomeClass { public string Name
My question is related class design. It is really hard to explain everything here
Before asking my question I would like to explain little about my architecture.My data
Can anyone explain why isn't this possible (at least in .Net 2.0): public class

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.