# Classes, Interfaces, and Object-oriented Programming, 19 Exercises

**URL:** <https://forum.codewithmosh.com/t/classes-interfaces-and-object-oriented-programming-19-exercises/16135>\
**Category:** TypeScript\
**Created:** [October 28, 2022, 7:17pm UTC](https://forum.codewithmosh.com/t/classes-interfaces-and-object-oriented-programming-19-exercises/16135 "2022-10-28T19:17:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EnsignRho](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EnsignRho](https://forum.codewithmosh.com/u/EnsignRho)\
**Post date:** [October 28, 2022, 7:17pm UTC](https://forum.codewithmosh.com/t/classes-interfaces-and-object-oriented-programming-19-exercises/16135/1 "2022-10-28T19:17:19Z")

</div>

There is an implementation for the:

```auto
let employee = {
    name:'John Smith',
    salary:50_000,
    address:{
        street:'Flinders st',
        city:'Melbourne',
        zipCode:3144,
    },
}

```

That looks like this:

```auto
interface Address {
    street:string;
    city:string;
    zipCode:number;
}

interfaceEmployee {
    name:string;
    salary:number;
    address:Address;
}

```

Is this also valid?

```auto
interface Address
{
	street: string;
	city: string;
	zipCode: number;
}

interface Employee extends Address
{
	name: string;
	salary: number;
}

```

In this case you’ll have access to members without going through [address.] to reference sub-members.

Is one form more desirable than the other?

Thank you.

---

<div class="post-metadata">

**Author:** ![EnsignRho](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@EnsignRho](https://forum.codewithmosh.com/u/EnsignRho)\
**Post date:** [October 28, 2022, 8:12pm UTC](https://forum.codewithmosh.com/t/classes-interfaces-and-object-oriented-programming-19-exercises/16135/2 "2022-10-28T20:12:49Z")

</div>

I see it now. The original data had the address sub-member, so it should be done that way.

Takes a little time for my brain to interpret what my eyes see sometimes. 🙂
