zoukankan      html  css  js  c++  java
  • C++第三章理论题错题整理2

    Because the cstdarg defines this header file to process the unknown number of arguments.

    va_list is provided by C++ to access manipulated arguments in function.

    va_start initialises the the list of arguments in <stdarg.h> header file.

    __cdecl is the default calling convention for a compiler in c++.

        #include <iostream>
        using namespace std;
        int func (int a, int b)
        {
            cout << a;
            cout << b;
            return 0;
        }
        int main(void)
        {
            int(*ptr)(char, int);
            ptr = func;
            func(2, 3);
            ptr(2, 3);
            return 0;
        }

    In this program, we can’t do the casting from char to int, So it is raising an error.

     The data types are mandatory for declaring the variables in the function pointers.

    There are two types of macros. They are object-like and function-like.

    Macro Preprocessor only replaces occurance of macro symbol with macro symbol value, So we can’t increment the value.

    What is the other name of the macro? scripted directive

    Abstract classes in C++ are purposely defined for making base classes containing atleast one virtual function which can be overloaded on inheritance, which means single function name for different sub-classes, hence acts as an interface.

    How many types do functions fall depends on modularization?  There are two types of functions. They are program control and specific task.

    There are two types of modular programming. They are interface and implementation.

    Namespace allows you to group class, objects, and functions. It is used to divide the global scope into the sub-scopes.

    The main aim of the namespace is to understand the logical units of the program and to make the program so robust.

    Namespace does not have any specifiers associated with it like classes or structures.

    A namespace without name is called unnamed namespace and is valid in that scope only. So its like global scope of variable. One can access that var from main() function.

    When an exception is arisen mean, the exception is caught by handlers and then it decides the type of exception.

    When exceptions are not caught in any program then program throws error.

    What will happen when the handler is not found for an exception?  calls the standard library function terminate()

  • 相关阅读:
    PB笔记之导入、导出组件
    pb笔记之数据窗口设置操作
    PB笔记之第一行数据不能删除的解决方法
    PowerBuilder学习笔记之行删除卡死问题
    PB笔记之数据窗口行不能编辑的原因
    PB笔记之导出为Excel的方法
    PowerBuilder学习笔记之导入Excel数据
    PB笔记之数据窗口添加虚拟列的方法
    PowerBuilder学习笔记之调用事件和函数
    Apache按日切分日志
  • 原文地址:https://www.cnblogs.com/hhlys/p/13470903.html
Copyright © 2011-2022 走看看