Difference Between Traits and Abstract Classes in Scala Last Updated : 13 Feb, 2019 Comments Improve Suggest changes Like Article Like Report In Scala, an abstract class is constructed using the abstract keyword. It contains both abstract and non-abstract methods and cannot support multiple inheritances. Example: Scala // Scala program to illustrate how to // create an abstract class // Abstract class abstract class Abstclass { // Abstract and non-abstract method def portal def tutorial() { println("Scala tutorial") } } // GFG class extends abstract class class GFG extends Abstclass { def portal() { println("Welcome!! GeeksforGeeks") } } object Main { // Main method def main(args: Array[String]) { // object of GFG class var obj = new GFG (); obj.tutorial() obj.portal() } } Output: Scala tutorial Welcome!! GeeksforGeeks Like a class, Traits can have methods(both abstract and non-abstract), and fields as its members. Traits are just like interfaces in Java. But they are more powerful than the interface in Java because in the traits we are allowed to implement the members. Example: Scala // Scala program to illustrate how to // create traits // traits trait mytrait { // Abstract and non-abstract method def portal def tutorial() { println("Scala tutorial") } } // GFG class extends trait class GFG extends mytrait { def portal() { println("Welcome!! GeeksforGeeks") } } object Main { // Main method def main(args: Array[String]) { // object of GFG class var obj = new GFG (); obj.tutorial() obj.portal() } } Output: Scala tutorial Welcome!! GeeksforGeeks Traits Abstract Class Traits support multiple inheritance. Abstract class does not support multiple inheritance. We are allowed to add a trait to an object instance. We are not allowed to add an abstract class to an object instance. Traits does not contain constructor parameters. Abstract class contain constructor parameters. Traits are completely interoperable only when they do not contain any implementation code. Abstract class are completely interoperable with Java code. Traits are stackable. So, super calls are dynamically bound. Abstract class is not stackable. So, super calls are statically bound. Comment More infoAdvertise with us Next Article Difference Between Traits and Abstract Classes in Scala A ankita_saini Follow Improve Article Tags : Scala Scala Scala-OOPS Similar Reads Difference Between Haskell and Scala Haskell is a general-purpose programming language that is normalized and has unadulterated practical programming features. It was developed and structured by Lennart Augustsson, John Hughes, Paul Hudak, John Launchbury, Simon Peyton Jones, Philip Wadler, and Erik Meijer. Its composing discipline is 4 min read Difference Between Groovy and Scala Groovy : Groovy is an object-oriented high-level programming language that is Java syntax compatible. It is used as both programming language and scripting language for the Java Platform. In the year 2004, Groovy language was developed by Bob McWhirter and James Strachan. The source code of Groovy i 3 min read Abstract Classes in Scala Abstraction is the process to hide the internal details and showing only the functionality. In Scala, abstraction is achieved by using an abstract class. The working of the Scala abstract class is similar to Java abstract class. In Scala, an abstract class is constructed using the abstract keyword. 5 min read Difference between Case Objects vs Enumerations in Scala Scala offers multiple constructs for representing a fixed set of values, among which case objects and enumerations stand out. While both serve similar purposes, they have distinct characteristics and use cases. In this article, we'll explore the differences between case objects and enumerations in S 4 min read Abstract types vs Generics in Scala In this discussion, we will explore abstract types and generics in Scala, highlighting their differences. Abstract types are types that include abstract members, while generics are types that can take other types as parameters. Let's delve into the disparities between these two concepts. Scala Abstr 2 min read Like