Pen questions of a game company (2)

Source: Internet
Author: User

The following are part of the written questions developed by a game company C ++ in no order.


1. What is object-oriented? What are object-oriented features? Briefly describe these features.

2. Use variable A to give the following definition

A) An integer)
B) a pointer to an integer (a pointer to an integer)
C) a pointer to a pointer pointing to an integer (a pointer to an intege) r
D) an array of 10 integers (an array of 10 integers)
E) an array with 10 pointers pointing to an integer. (An array of 10 pointers to integers)
F) A pointer to an array with 10 integers (a pointer to an array of 10 integers)
G) a pointer to a function. The function has an integer parameter and returns an integer number (a pointer to a function that takes an integer as an argument and returns an integer)
H) An array with 10 pointers pointing to a function, this function has an integer parameter and returns an integer (an array of ten pointers to functions that take an integer argument and return an integer)

3. Meaning of the following const

Const int;

Int const;

Const int *;

Int const *;

Int * const;

Const int * const;

4. Do you know the design mode? Summarize the features of the design model.

5. Use an object-oriented perspective to explain the relationship between players, items, monsters, NPC, map triggers, and money and management methods. (This is basically the case)

6. What is "reference? What are the characteristics of "reference? What is the difference between "reference" and pointer?

7,

#include <iostream>using namespace std;class B {public:    B() {        std::cout << "default constructor" << std::endl;    }    ~B() {        std::cout << "destructed" << std::endl;    }    B (int a) : data(a) {        std::cout << "construct by parameter " << data << std::endl;    }private:    int data;};B Play(B b) {    return b;}

Find the output of the following main function

int main(){    B a = Play(10);    B b = Play(a);    return 0;}

int main(){    B a = Play(5);    B b = Play(10);    return 0;}

8. It is known that the prototype of the strcpy function is char * strcpy (char * strdest, const char * strsrc), where strdest is the destination string and strsrc is the source string.

Do not call the string library function of C ++/C. Compile the strcpy function.

9. Compile a macro min and return a small value of two numbers.

10. Compare the four types of Conversion characters of C ++: static_cast, dynamic_cast, reinterpret_cast, and const_cast.

11. Why should I add the extern "C" declaration to call the function compiled by the C compiler in the C ++ program?

4th and 5 are the final finale questions, which are placed in the first place.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.