You can get the type of an object with
::class, and compare those:
val sameClass = obj1::class == obj2::class
More specifically, this section of the above documentation describes that
::class on an object gives you exactly what you want, the exact class of the instance you’re calling it on.
- I can’t reach any class member from a nested class in Kotlin
- What is the difference between ::class and ::class.java in Kotlin?
- What is the difference between static func and class func in Swift?
- How to properly document S4 class slots using Roxygen2?
- Swift: Test class type in switch statement
- ‘POCO’ definition
- UML class diagram enum
- CKEditor automatically strips classes from div
- Kotlin: Equivalent of getClass() for KClass
- Class constructor type in typescript?
- Classes vs. Functions [closed]
- What are public, private and protected in object oriented programming?
- Tools for creating Class Diagrams [closed]
- class overrule when two classes assigned to one div
- Why can’t Swift initializers call convenience initializers on their superclass?
- How do I declare a model class in my Angular 2 component using TypeScript?
- Creating class instance properties from a dictionary?
- Types and classes of variables
- What’s the difference between a protocol extended from AnyObject and a class-only protocol?
- How should I deal with object hierarchies in a RESTful API?
- constructor with parameters in UML class diagram
- Is it bad practice to have my getter method change the stored value?
- Julia: OOP or not
- class in R: S3 vs S4
- Kotlin File vs Class. Whats the difference?
- Relationship between a TypeScript class and an interface with the same name
- Dynamic class in Angular.js
- Why doesn’t Scala have static members inside a class?
- Unable to access variable from innerclass : Kotlin android
- Static Inner Class in Kotlin
- Implementing an indexer in a class in TypeScript
- Use of Custom Data Types in VBA
- Does swift have class level static variables? [duplicate]
- Is the word “Helper” in a class name a code smell?
- What exactly is a Class Factory?
- List of class’s properties in swift
- How to tell if an object is an instance of a class
- Counting instances of a class?
- Scala: Ignore case class field for equals/hascode?
- Main method in Scala
- Is it OK to put propTypes and defaultProps as static props inside React class?
- Limitation with classes derived from generic classes in swift
- Why are classes inside Scala package objects dispreferred?
- How can I determine whether a Java class is abstract by reflection
- How to properly set up a PDO connection
- Show soft keyboard for dialog
- C++: Can a struct inherit from a class?
- What should I name my PHP class file? [closed]
- How to check if an array of strings contains a value in Kotlin