zoukankan      html  css  js  c++  java
  • How to use Union in c++?

    In c++, we should keep using c style union. Although c++ union supports constructor, we'd better not use it. Actually, no need to use constructor for union basically. Going deeper, even as the expanded union in c++, it can't support constructor, destructor, copy-constructor, operator=, and virtual function class level operations on its members. Like you can't put CString, Struct variables as a c++ union's members.

    The only two differences between a C++ struct and a class are that, by default, the members of a class are private, while the members of a struct are public and that structs are inherited from publically by default while classes are inherited from privately by default. Aside from these distinctions, structs and classes perform exactly the same function.
  • 相关阅读:
    JAVA日报
    JAVA日报
    JAVA日报
    论文爬取(四)
    论文爬取(三)
    论文爬取(二)
    剑指 Offer 59
    剑指 Offer 58
    剑指 Offer 58
    剑指 Offer 57
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1401800.html
Copyright © 2011-2022 走看看