# DefaultConstructible

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/trait-defaultconstructible/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait DefaultConstructible: ObjectType
```

A class with a default constructor: the `new` part of `ferro_class_info!`,
reached through the type rather than through its [`TypeInfo`](/docs/0.5.0/api/ferroui-base/struct-typeinfo/).

Generic code that creates an instance of a class it names statically
(`PageType::of::<T>()` of `ferroui-controls`) calls this, so the compiler
checks that the class has a default constructor, and the constructor is
linked only where something creates the class (#612). Implemented by
`ferro_class_info!` for every class that declares `new`. It works with
and without the tables of types; the constructor a [`TypeInfo`](/docs/0.5.0/api/ferroui-base/struct-typeinfo/) carries
(`TypeInfo::default_constructor`) exists only with them.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/type_system.rs#L749)

## Members

- [`new_instance`](#function-new_instance)

<a id="function-new_instance"></a>

### new_instance

```rust
fn new_instance() -> Ref<Self>
```

Creates an instance as the parameterless `new()` of the class does.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/type_system.rs#L751)

## Trait implementations

- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
