Inheritance Utilization and Pointer

Asked 2 years ago, Updated 2 years ago, 29 views

It's a question that doesn't matter whether it's C++ or C#.

Inheritance related questions

 I learn the concept of inheritance, learn it, and know the advantages. If you use inheritance as a sample code,
 I can relate to some extent that code is recycled and productivity increases.

 But there are some things that I haven't actually worked on a lot of projects, and I don't know when to use inheritance 
 That's right, I don't understand why I have to write it. Maybe it's because we haven't designed that kind of structure.

 Is there a sample code to study about inheritance?

Pointer related questions

I pass the objects with a pointer and use them, sometimes with a pointer, sometimes just as an object
I don't know what the standard is and why it's used as a pointer.

c++ c#

2022-09-22 18:28

1 Answers

When you learn object orientation simply by grammar, that step comes.

I know the grammar, but...When is the actual use...

The best practice is to study GOF design patterns.

Studying design patterns gives you the ability to design using object orientation.

I didn't understand the pointer.The pointer is an easy part to understand when you learn the assembly. It's just a variable that stores the memory address.

There's a large structure, and you want to share it with multiple functions, so if you want to take the modified state of function a and use it in function b, you can copy it every time, but if you create a structure and pass its memory address, you can access it without copying it.

But if you don't understand...In fact, there is no royal road. Hold on to the debugger and analyze it until you understand it. It's not difficult.


2022-09-22 18:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.