(c + +) Interview in English-basic Concepts.

Source: Internet
Author: User
Tags volatile

Constructed, change value
, same time 

TD Width= "202" >

 

Question

Key words

Anwser

A

Assignment operator

 

 

 

Abstract class

 

It is a class, a has one, or more pure virtual functions.

Assignment &
Initialization

Assignment changes th E value of the object that has already been constructed. Initialization constructs a new object and gives it a value at the same time. 

array &
Linked list

An array is a sequential collection of same kind of data elements.
Linked list is a data structure which store same kind of data elements but not in continuous memory locations and size is Not fixed. The
the size of an array is a fixed whereas size of linked list is variable.
in array the data elements be stored in continuous memory locations and in linked list it is non continuous memory L Ocations.
addition, removal of data is easy in linked list whereas in arrays it is complicated.

 

Argument passing

Call-by-value
Call-by-reference

Call-by-value. This method copies the
Value of a argument into the formal parameter of the subroutine
Call-by-reference is the second-a-subroutine can be passed arguments. This method
Copies the address of an argument (not it value) into the parameter

B

 

 

 

C

Constructor

Object, initialize

Constructor creates an object and initializes it. It also creates vtable for virtual functions. It is different from and methods in a class.

Copy constructor

Initialze by another object

Constructor which initializes the IT ' s object member variables ( by shallow copying) with another object of the same class. If you don ' t implement one in your class then compiler implements one for you. 
Q20. When is copy constructors called?  
A20. Copy constructors is called in three cases: ,
(1) When a function returns an object of the that class by value, 
(2) When the object was passed by value as an argument to a function, and, 
(3) If you constr UCT an object based on another object of the same class (Circle c1=c2;).  

Conversion constructor

Const reference arguments

A) Using const protects you against programming errors that inadvertently alter DAT A.
B) Using Const allows function to process both const and non-const actual arguments, while a function without const The prototype can only accept non constant arguments.
C) Using A const reference allows the function to generate and use a temporary variable appropriately.

 

Container class

 

A container class is a class was used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose are to hide the topology used for maintaining the list of objects in Memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; When the container was holding a group of objects that was all the same, the container was called a homogeneous container.
Example:vector, list, map.

 

Const

 

Indicates that constants cannot be modified

 

 

 

 

D

destructor

Delete

destructor usually deletes any extra resources allocated by the object.

 

Data structure

 

A data structure is a-a-organizing data, considers not-only-the items stored, but also their relationship Other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.

 

 

 

 

E

Encapsulation

Code and data

Encapsulation is welding of code and data together into objects.

F

 

 

 

G

Globle Variable &
Local variable

 

In memory storage
Globle Variable:staic Local:stack
Global variables are stored in a static database, and local variables are on the stack.

H

Heap &
Stack

 

The heap is heaps, space is allocated and freed by manual operations, and it has a large storage area of free storage.
Stack is a stack, which is automatically allocated and released by the operating system, and the space on the stack is limited. During compilation, variables and functions allocate memory on the stack, and the pass-through of parameters at runtime function calls is performed on the stack.

I

Inheritance

Derived Properties/behavior

Inheritance is a mechanism through which a derived class inherits the properties and behavior of their base class

Iterator class

Traverse
Container class

A class that's used to traverse through the objects maintained by a container class. There is five categories of iterators: 
input iterators, output iterators, forward iterators, bidirectional iter Ators, random access.

 

inline function

Expanded

An-inline function is a-function whose code is expanded on line at the-which
It is invoked, rather than being called.
The compiler does not directly call a function but expands the code of the inline function and inserts it into the program code
There is ways to the create an inline function.
1) The first is to use the inline modifier. Using the inline modifier
2) defining the code to a member function inside a class declaration. Creates an inline function in a class.
Any function, which is defined inside a class declaration is automatically made to an inline function. It is not a necessary to precede its declaration with the keyword inline.

J

 

 

 

K

 

 

 

L

 

 

 

M

malloc ()/free (), New/delete

Memory, Constructor/object

1) malloc ()/free () is a function using C + +, New/delete is operator, using in C + +
2) malloc ()/free () is for the dynamic memory Using/release, New/delete is Object construtor/destuctor

 

Memory allocation

 

1) static in the existence of the program compile time has been allocated well, this block exists throughout the operation of the program exists. For example, global change
2) When a stack executes a function, the storage unit of the local variable within the function can be created on the stack,
3) heap (dynamic), malloc ()/free (), New/delete

N

 

 

 

O

Overloading (Heavy Duty) &
overriding (Rewrite/overwrite)

same function name, diff augs
Same Fun/augs, dif method

Overloading is a method, allows defining multiple member functions with the same name but different signatures.
Overriding is a method, the allows the derived class to redefine the behavior of member functions the which class Inherits from a base class.

P

Polymorphism

Virual funcition, inheritance

One interface, Mutipul methods
virual function and inheritance make C + + to support polymorphism

 

Private,protected,public

Members and friend class
+derived member and friend
+everyone

Private members is accessible only by members and friends of the class. Protected members is accessible by members and friends of the class, and by members and friends of derived classes. Public members is accessible by everyone.

 

Pure virtual function

virtual void Show_area () = 0;

A pure virtual function is a function declared in a base class this has no definition relative to the base. "

 

Potinter &
Reference

Initialization/change/void

1) Reference must is initialized, while pointer no need.
2) After reference are initialized, the value can not be changed, but pointer object maybe
3) can ' t use reference for a void, but can use pointer to a void value

Q

 

 

 

R

Reference

&

C + + ' s default parameter-passing convention is call-by-value,manually create a call-by-reference by passing the address of An argument (i.e., apointer to the argument) to a function.

S

struct & Class

Default Access Level

The default access level assigned to members of the struct are public and the default access level assigned to a class is PRI Vate.
The main difference between structs in C and C + + is that structs in C can not contain member functions, whereas structs in C + + can.
The main difference between struct and class in C + + is that the default access permissions are different, struct defaults to public, and class defaults to private

 

Static member of a class

exist once

Static data members exist once for the entire class, as opposed to non-static data members, which exist individually in EA Ch instance of a class.

 

Static

 

1) Static Local Variables
A static variable to maintain its value between function calls.
2) Static Global Variables

 

Signature

 

Function ' s signature is its name plus the number and types of the parameters it accepts.

 

Silently write and call

 

constructors, destructors, copy constructors,
Assignment operators, and address-of operators.

 

Storage classes

Auto/register/static/extern

Auto: the default. Variables is automatically created and initialized when they is defined and is destroyed at the end of the block Contai Ning their definition. They is not visible outside that block
Register: A type of auto variable. A suggestion to the compiler-a CPU register for performance
static: A variable that's known only in the function that contains it definition is never destroyed and RET Ains its value between calls to that function. It exists from the time of the program begins execution
extern: A static variable whose definition and placement is determined if all object and the library modules are Co Mbined (linked) to form the executable code file. It can visible outside the file where it is defined.

T

Template & Macro

 

Using template to create generic (template) functions and classes. In a template function or class, the type of data upon which the function or class operates is specified as a parameter. Thus, can use one function or class with several different types of data,without have to explicitly recode specific Versions for each data type.

 

This pointer

Object ' s function call

The this pointer are a pointer accessible only within the member functions of a class, struct, or union type. It points to the object for which the member function is called. The Static member functions do not has a this pointer.

U

Using ' declaration?

 

A using declaration makes it possible to use a name from a namespace without the scope operator.

V

Virtual &
non-virtual function

Run-time
Compile time

The behavior of a non-virtual function is known at compile time and the behavior of a virtual function is not known Unti L The run time.

 

virtual function

Derived class
Redefined

A virtual function is a function that uses the Vitual declaration in a base class and is redefined in one or more derived classes
A virtual function is a function which is declared as virtual in a base class and redefined
In one or more derived classes

 

Virtual destructor?

 

Sing virtual destructors, you can destroy objects without knowing their type

 

Volatile

 

The volatile keyword is a type modifier, and the type variable that it declares can be changed by factors that are unknown to some compilers.
For example: Operating system, hardware, or other threads. Encountered this keyword declaration

(c + +) Interview in English-basic Concepts.

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.