C#C
C#4y ago
Bobby Bob

Confused about is-a relationship (static and dynamic types) [Answered]

C#
// Testing
BaseClass newObject = new BaseClass();
BaseClass newObjectB = new DerivedClass(209.21312f);


What's with the syntax on the second line? And why would we ever use the syntax on the second line if it limits us to using only the members in DerivedClass? Like is

C#
BaseClass newObjectB = new DerivedClass(209.21312f);


The same as
C#
BaseClass newObjectB = new BaseClass(209.21312f)
Was this page helpful?