# Can cast class type from another class? (Want to reduce redundant part)

**URL:** <https://verificationacademy.com/forums/t/can-cast-class-type-from-another-class-want-to-reduce-redundant-part/34728>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, class, handle\
**Created:** [July 25, 2018, 1:57am UTC](https://verificationacademy.com/forums/t/can-cast-class-type-from-another-class-want-to-reduce-redundant-part/34728 "2018-07-25T01:57:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [July 25, 2018, 2:33am UTC](https://verificationacademy.com/forums/t/can-cast-class-type-from-another-class-want-to-reduce-redundant-part/34728/2 "2018-07-25T02:33:25Z")

</div>

_In reply to [lycos007](https://verificationacademy.com/forums/t/can-cast-class-type-from-another-class-want-to-reduce-redundant-part/34728):_

You need to explain how classA and classB are different from each other, and how you expect to use handle. Normally you would just extend classA and classB from a common base class. The you can selectively choose which class to construct, and store its handle in a base class variable.

---

_[View the full topic](https://verificationacademy.com/forums/t/can-cast-class-type-from-another-class-want-to-reduce-redundant-part/34728)._
