I’ve been using Unity to do virtual simulation stuff lately, but of course, it’s still known in the gaming world, like King of Glory, which was developed in Unity.
Using Unity requires learning C#. I always thought C# was an upgraded version of C++ because C++ is an improved version of C, but C# is as close to the first two as Java and JavaScript.
The C language
C is a process-oriented computer programming language, which is different from C++, C#, Java and other object-oriented programming languages. C was designed to provide a programming language that could compile in an easy way, handle low-level memory, produce only a small amount of machine code, and run without any runtime environment support.
And it is a very excellent and important language, Window, Liunx, UXIX system are written in C language, we can see his importance.
C++
C++ is a statically typed, compiled, general-purpose, case-sensitive, irregular programming language that supports procedural, object-oriented, and generic programming.
It is considered an intermediate language that combines the characteristics of both high-level and low-level languages.
OOP(Object-oriented) Language features:
- Encapsulation: A mobile phone is made up of many parts, including processor, memory, I/O Settings, screen, battery and so on. When these things are put together, the mobile phone is called encapsulation.
- Inheritance: Lao Tzu gave birth to a son, the son inherited the characteristics of Lao Tzu, there is inheritance.
- Polymorphism: I am the son of my parents at home, I am the boss’s employee in my company, and I am a shenzhen person in Shenzhen. In object-oriented languages, calling the same method will have different behavior, which is called polymorphism.
C Sharp
C#, also known as C#, is a modern, general-purpose, object-oriented programming language developed by Microsoft and approved by Ecma and ISO.
As for its naming, let’s look at its origins:
- Microsoft is trying to save
Visual Basic
Unfinished business - plagiarism
jxx
Language and namedj++
- After being sued, he learned that he was an improvement on THE C language
- named
C#
Yes, it was the Java language, and C# now bears a striking resemblance to Java.
The relationship between the three
Classic case: Put an elephant in the fridge
C:
C is a very cold person, so the answers are cold:
Me: Hello C language, I want to put the elephant in the refrigerator, help me do?
C: good
Me: So how do we do that?
C: guess
Me: Uh… Should we create an elephant first?
C:
Me: How?
C: guess
I had to go to the file, oh, malloc a piece of memory.
Me: Ok, I’ll use malloc and apply for a space for elephants, ok?
C: good
Me: Uh… How is an elephant built?
C: guess
I… Went to see the structure of the elephant
Me: Ok… I’ve defined an elephant’s data structure. What do I do next?
C: guess
I have this unspeakable feeling in my heart…
Me: Oh well, I’ll create a refrigerator, and the steps should be the same as elephants.
C: well
I looked at the structure of the refrigerator, and I defined a refrigerator struct.
Me: Ok, the refrigerator structure came out, how to put it?
C: hum
I… Silently type on Stack Overflow how to put an elephant in a refrigerator C.
Me: finally found the answer, define a method, put in the elephant’s nose, eyes and ears. OK, it’s all in. C, you can print it out.
C: Perm perm perm perm perm perm
Me: ha ha ha C you finally not high cold
.
I: ah, you zha don’t talk? C? Do you have a fever?
Immediately a basin of water was poured on.
The end.
C + + :
C++ is a very knowledgeable kid, relatively young and not that cool.
Me: C * * * *, shall we put the elephant in the fridge?
C + + : roll
Don’t speak high cold?
Me: well, I was wrong, dear C++, let’s put the elephant in the fridge.
C++ : ok, the elephant data type has been defined, the refrigerator data type has been defined, you need to construct a separate one.
Me: Ok.
So I looked at the documentation and I knew I was going to use new
Me: OK, dear C++, I want to build an elephant.
C++ : ok, there are 13 ways to construct an elephant. Which one would you choose?
I…
Me: Tell me about it.
C + + : OK, first of all, you can build it on the stack, and the nice thing about that is that it makes it easier to manage resources, and the syntax is a little bit nicer, you can use RAII, and if you don’t know anything about RAII, you can look it up in CPpreference, or you can build it on the heap, you can build a big, big elephant, And…
A month later, C++ finally finished. I have a beard, too… Shave and go back to work
Me: ok, C++, I’ll build an elephant on the stack.
C++ : you don’t love me.
Me:??
C++ : you didn’t even say “honey”.
I…
Me: well, dear C++, I want to simply build an elephant.
C++ : ok, you can choose to build an African elephant or an American elephant or an Antarctic elephant, what is the skin color of an elephant, you can set the size of an elephant’s butt, you can set the gender and sexual orientation of an elephant, what do you want…
Me: I just want a simple, default one.
C++ : ok, one is constructed, you can choose how to initialize it, there are 13 initialization methods, the latest unified initialization is recommended.
I…
Me: Unified initialization
C++ : ok, we can build the refrigerator.
Me: Ok…
After a month of selection, the construction of the refrigerator.
C++ : ok, fridge provides addElephant method, can be used directly oh.
Me: Wow great, ok, I’ll use this method.
C++ : this method provides multiple overloads that can be copied, moved, or forwarded directly, saving the need to build an elephant before moving it to the fridge.
Me:… Why didn’t you say so
C++ : why didn’t you ask earlier?
Me: Let’s use the mobile one.
C++ : OK, use STD ::move to convert the constructed elephant to an rvalue reference.
I looked bewildered, but I did as I was told.
I: that’s fine
C++ : OK, start to put in the refrigerator oh, very fast.
All of a sudden
C++ : error 1556 error, molecules and atoms are not convertible types, there is no + operator between panda and Edison, etc.
I…
I: look for data on the net, say to see last line about the same, good see. Well, it looks like there’s an error on line 31. What’s the error? The error message didn’t make any sense. Feel free to change. Compile, run.
C + + : ok, already 12 meters to hip circumference, left arm is 13 meters long and 14 meters long in her right arm, like an elephant, not marry and have children, since the childhood family education is good, read the classics of African female elephants into the orange, 50 meters, 60 meters wide, three hundred meters thick, a temperature of minus three baidu, refrigerant lake brand is this card, rated voltage 220 v in the fridge.
I… A sigh of relief.
C # :
Me: I want to put the elephant in the refrigerator.
C# : Good master, my father Microsoft has written the elephant category, also wrote the refrigerator category, you just need to new it.
Me: OK, new OK, put it in the fridge.
C# : ok, already in, using the refrigerator extension method addElephant<> method.
Me: well, you are very good, can you play a little faster, just C++ play very fast.
C# : for your security, no.
Me: Uh… I’d like to adjust the size of the elephant’s ears.
C# : sorry, can’t adjust. You can set the shape of the elephant’s ear, has defined a variety of ear shapes for you, you can also adjust the color of the elephant, has defined a variety of skin color for you.
I: forget not to adjust, so it.
C# : ok. If you need speed, or need to grasp every detail of an elephant, you can also check out my brother, C++/CLR, who can do these features you proposed. You can bring him to me, and we can work together. You can also export the work done by C++ to binary form, which I can use directly.
Me: Ok thanks, no thanks.
C# : Ok, have a nice day.
Finished!
Your likes, comments and concerns are the biggest encouragement for xiaobian O(∩_∩)O👍👍👍
I am Geek Ape Xiaobing, a public account [Geek Ape], which records the learning and growth of independent developers and leads to wealth and freedom together.