react源码分析:组件的创建和更新

news2024/9/27 9:28:20

这一章节就来讲讲ReactDOM.render()方法的内部实现与流程吧。
因为初始化的源码文件部分所涵盖的内容很多,包括创建渲染更新渲染Fiber树的创建与diffelement的创建与插入,还包括一些优化算法,所以我就整个的React执行流程画了一个简单的示意图。

React源码执行流程图

在这里插入图片描述

从图中我们很清晰的看到ReactDOM.render()之后我们的组件具体干了什么事情,那么我们进入源码文件一探究竟吧。

// packages/react-dom/src/client/ReactDOMLegacy.js
export function render(
  element: React$Element<any>, // 经过babel解析后的element
  container: Container, // 根组件节点: document.getElementById('root')..
  callback: ?Function,// 回调
) {
  // 做合法容器的验证(根组件)
  invariant(
    isValidContainer(container),
    'Target container is not a DOM element.',
  );

  // 开发模式下
  if (__DEV__) {
    const isModernRoot =
      isContainerMarkedAsRoot(container) &&
      container._reactRootContainer === undefined;
    if (isModernRoot) {
      console.error(
        'You are calling ReactDOM.render() on a container that was previously ' +
          'passed to ReactDOM.createRoot(). This is not supported. ' +
          'Did you mean to call root.render(element)?',
      );
    }
  }
  // 返回 legacyRenderSubtreeIntoContainer
  return legacyRenderSubtreeIntoContainer(
    null,
    element,
    container,
    false,
    callback,
  );
}

所以当前render函数仅仅只是做了部分逻辑,阅读React源码,给你一个直观的感受就是他拆分的颗粒度非常的细,很多重复命名的函数,可能是见名知意的变量名只有那么几个常见的组合吧,这也是React作者的用心良苦吧。

追根究底我们还是得看一看legacyRenderSubtreeIntoContainer究竟干了些不为人知的事情呢

legacyRenderSubtreeIntoContainer

function legacyRenderSubtreeIntoContainer(
  parentComponent: ?React$Component<any, any>, // 父级组件
  children: ReactNodeList, // 当前元素
  container: Container, // 容器 eg:getElementById('root')
  forceHydrate: boolean,  callback: ?Function,
) {
  if (__DEV__) {
    topLevelUpdateWarnings(container);
    warnOnInvalidCallback(callback === undefined ? null : callback, 'render');
  }

  // TODO: Without `any` type, Flow says "Property cannot be accessed on any
  // member of intersection type." Whyyyyyy.
  let root: RootType = (container._reactRootContainer: any);
  let fiberRoot;
  // 如果有根组件,表示不是初始化渲染,则走下面的批量更新
  // 没有根组件,那么就要去创建根组件了
  if (!root) {
    // 初始化挂载
    root = container._reactRootContainer = legacyCreateRootFromDOMContainer(
      container,
      forceHydrate,
    );
    fiberRoot = root._internalRoot;
    if (typeof callback === 'function') {
      const originalCallback = callback;
      callback = function() {
        const instance = getPublicRootInstance(fiberRoot);
        originalCallback.call(instance);
      };
    }
    // 不必要的批量更新
    unbatchedUpdates(() => {
      updateContainer(children, fiberRoot, parentComponent, callback);
    });
  } else {
    fiberRoot = root._internalRoot;
    if (typeof callback === 'function') {
      const originalCallback = callback;
      callback = function() {
        const instance = getPublicRootInstance(fiberRoot);
        originalCallback.call(instance);
      };
    }
    // 批量更新
    updateContainer(children, fiberRoot, parentComponent, callback);
  }
  return getPublicRootInstance(fiberRoot);
}
  • 有根节点的情况下,我们判定为非首次渲染状态,执行updateContainer
  • 没有根节点的情况下,我们判定为首次渲染,接着去创建根节点,执行legacyCreateRootFromDOMContainer,拿到了root之后,我们会去触发执行updateContainer

legacyCreateRootFromDOMContainer

function legacyCreateRootFromDOMContainer(
  container: Container, // 容器
  forceHydrate: boolean, // value:false
): RootType {
  const shouldHydrate =
    forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
  // First clear any existing content.
  if (!shouldHydrate) {
    let warned = false;
    let rootSibling;
    while ((rootSibling = container.lastChild)) {
      if (__DEV__) {
        if (
          !warned &&
          rootSibling.nodeType === ELEMENT_NODE &&
          (rootSibling: any).hasAttribute(ROOT_ATTRIBUTE_NAME)
        ) {
          warned = true;
          console.error(
            'render(): Target node has markup rendered by React, but there ' +
              'are unrelated nodes as well. This is most commonly caused by ' +
              'white-space inserted around server-rendered markup.',
          );
        }
      }
      container.removeChild(rootSibling);
    }
  }
  if (__DEV__) {
    if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
      warnedAboutHydrateAPI = true;
      console.warn(
        'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
          'will stop working in React v18. Replace the ReactDOM.render() call ' +
          'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
      );
    }
  }

  // 关注createLegacyRoot
  return createLegacyRoot(
    container,
    shouldHydrate
      ? {
          hydrate: true,
        }
      : undefined,
  );
}

createLegacyRoot

export function createLegacyRoot(
  container: Container, // 容器
  options?: RootOptions,
): RootType {
  //关注ReactDOMBlockingRoot
  return new ReactDOMBlockingRoot(container, LegacyRoot, options);
}

相关参考视频讲解:进入学习

ReactDOMBlockingRoot

function ReactDOMBlockingRoot(
  container: Container, // 容器
  tag: RootTag, // LegacyRoot = 0;BlockingRoot = 1;ConcurrentRoot = 2;
  options: void | RootOptions,
) {
  this._internalRoot = createRootImpl(container, tag, options);
}
  • 我们在这里看到this._internalRoot出来了,因为在先前这个值会给到fiberRoot,所以我们再去看一看这个_internalRoot是怎么创建出来的

createRootImpl

function createRootImpl(
  container: Container,  tag: RootTag,  options: void | RootOptions,
) {
  // Tag is either LegacyRoot or Concurrent Root
  const hydrate = options != null && options.hydrate === true;
  const hydrationCallbacks =
    (options != null && options.hydrationOptions) || null;
  const mutableSources =
    (options != null &&
      options.hydrationOptions != null &&
      options.hydrationOptions.mutableSources) ||
    null;

  // 关注createContainer
  const root = createContainer(container, tag, hydrate, hydrationCallbacks);
  markContainerAsRoot(root.current, container);
  const containerNodeType = container.nodeType;

  if (enableEagerRootListeners) {
    const rootContainerElement =
      container.nodeType === COMMENT_NODE ? container.parentNode : container;
    listenToAllSupportedEvents(rootContainerElement);
  } else {
    if (hydrate && tag !== LegacyRoot) {
      const doc =
        containerNodeType === DOCUMENT_NODE
          ? container
          : container.ownerDocument;
      // We need to cast this because Flow doesn't work
      // with the hoisted containerNodeType. If we inline
      // it, then Flow doesn't complain. We intentionally
      // hoist it to reduce code-size.
      eagerlyTrapReplayableEvents(container, ((doc: any): Document));
    } else if (
      containerNodeType !== DOCUMENT_FRAGMENT_NODE &&
      containerNodeType !== DOCUMENT_NODE
    ) {
      ensureListeningTo(container, 'onMouseEnter', null);
    }
  }

  if (mutableSources) {
    for (let i = 0; i < mutableSources.length; i++) {
      const mutableSource = mutableSources[i];
      registerMutableSourceForHydration(root, mutableSource);
    }
  }

  // 关注root
  return root;
}
  • 见名知意关注createContainer为创建容器,看其源码

createContainer

// packages/react-reconciler/src/ReactFiberReconciler.old.js
export function createContainer(
  containerInfo: Container, // 容器
  tag: RootTag, // LegacyRoot = 0;BlockingRoot = 1;ConcurrentRoot = 2;
  hydrate: boolean,  hydrationCallbacks: null | SuspenseHydrationCallbacks,
): OpaqueRoot {
  // 关注createFiberRoot
  return createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks);
}

createFiberRoot

export function createFiberRoot(
  containerInfo: any,  tag: RootTag,  hydrate: boolean,  hydrationCallbacks: null | SuspenseHydrationCallbacks,
): FiberRoot {
  const root: FiberRoot = (new FiberRootNode(containerInfo, tag, hydrate): any);
  if (enableSuspenseCallback) {
    root.hydrationCallbacks = hydrationCallbacks;
  }

  // 关注createHostRootFiber
  const uninitializedFiber = createHostRootFiber(tag);
  root.current = uninitializedFiber;
  uninitializedFiber.stateNode = root;

  // 初始化更新队列
  initializeUpdateQueue(uninitializedFiber);

  return root;
}
  • 关注 root.currentuninitializedFiber.stateNode这两个玩意儿,后面有大作用,我们还是看看createHostRootFiber

createHostRootFiber

export function createHostRootFiber(tag: RootTag): Fiber {
  let mode;
  if (tag === ConcurrentRoot) {
    mode = ConcurrentMode | BlockingMode | StrictMode;
  } else if (tag === BlockingRoot) {
    mode = BlockingMode | StrictMode;
  } else {
    mode = NoMode;
  }

  if (enableProfilerTimer && isDevToolsPresent) {
    // Always collect profile timings when DevTools are present.
    // This enables DevTools to start capturing timing at any point–
    // Without some nodes in the tree having empty base times.
    mode |= ProfileMode;
  }

  return createFiber(HostRoot, null, null, mode);
}
  • 一眼望去这里便是对tag的处理,到了后面便是去创建fiber节点

createFiber

const createFiber = function(
  tag: WorkTag,  pendingProps: mixed,  key: null | string,  mode: TypeOfMode,
): Fiber {
  // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
  return new FiberNode(tag, pendingProps, key, mode);
};
  • 那么主角出来了,就是我们的FiberNode,这里才走完初始化的创建流程,

所以大致的流程就是上面的图里画的那样子,创建流程我们就告一段落,那我们再去看看更新的流程是怎么玩的。

我们知道除了ReactDOM.render()会触发更新流程之外,我们还有setState强制更新hooks里面的setXxxx等等手段可以触发更新,所谓setState那么不正好是我们Component原型上挂的方法嘛。我们回顾一下Component,那些更新都是调用了updater触发器上的方法,那么我们去看一下这个东西。

const classComponentUpdater = {
  isMounted,
  // setState
  enqueueSetState(inst, payload, callback) {
    const fiber = getInstance(inst);
    const eventTime = requestEventTime(); // 获取更新触发的时间
    const lane = requestUpdateLane(fiber); // 获取任务优先级

    //根据更新触发时间 + 更新优先级来创建更新任务对象
    const update = createUpdate(eventTime, lane); // 创建更新任务对象
    // const update: Update<*> = {
    //   eventTime, // 更新时间
    //   lane, // 优先级

    //   tag: UpdateState, // 更新类型:0更新,1替换。,2强制替换,3捕获型更新
    //   payload: null,// 需要更新的内容
    //   callback: null, // 更新完后的回调

    //   next: null, // 指向下一个更新
    // };
    // 把内容填上
    update.payload = payload;

    if (callback !== undefined && callback !== null) {
      if (__DEV__) {
        // 开发环境下腰给个警告
        warnOnInvalidCallback(callback, 'setState');
      }
      // 如果有回调,那么加上回调
      update.callback = callback;
    }
    // const update: Update<*> = {
      //   eventTime, // 更新时间 you
      //   lane, // 优先级 you 

      //   tag: UpdateState, // 更新类型:0更新,1替换。,2强制替换,3捕获型更新
      //   payload: null,// 需要更新的内容 you
      //   callback: null, // 更新完后的回调 you

      //   next: null, // 指向下一个更新
      // };

    enqueueUpdate(fiber, update);// 推入更新队列
    scheduleUpdateOnFiber(fiber, lane, eventTime);// 调度

    if (__DEV__) {
      if (enableDebugTracing) {
        if (fiber.mode & DebugTracingMode) {
          const name = getComponentName(fiber.type) || 'Unknown';
          logStateUpdateScheduled(name, lane, payload);
        }
      }
    }

    if (enableSchedulingProfiler) {
      markStateUpdateScheduled(fiber, lane);
    }
  },
  // replaceState
  enqueueReplaceState(inst, payload, callback) {
    const fiber = getInstance(inst);
    const eventTime = requestEventTime();
    const lane = requestUpdateLane(fiber);

    const update = createUpdate(eventTime, lane);
    update.tag = ReplaceState;
    update.payload = payload;

    if (callback !== undefined && callback !== null) {
      if (__DEV__) {
        warnOnInvalidCallback(callback, 'replaceState');
      }
      update.callback = callback;
    }

    enqueueUpdate(fiber, update);
    scheduleUpdateOnFiber(fiber, lane, eventTime);

    if (__DEV__) {
      if (enableDebugTracing) {
        if (fiber.mode & DebugTracingMode) {
          const name = getComponentName(fiber.type) || 'Unknown';
          logStateUpdateScheduled(name, lane, payload);
        }
      }
    }

    if (enableSchedulingProfiler) {
      markStateUpdateScheduled(fiber, lane);
    }
  },
  // forceUpdate
  enqueueForceUpdate(inst, callback) {
    const fiber = getInstance(inst);
    const eventTime = requestEventTime();
    const lane = requestUpdateLane(fiber);

    const update = createUpdate(eventTime, lane);
    update.tag = ForceUpdate;

    if (callback !== undefined && callback !== null) {
      if (__DEV__) {
        warnOnInvalidCallback(callback, 'forceUpdate');
      }
      update.callback = callback;
    }

    enqueueUpdate(fiber, update);
    scheduleUpdateOnFiber(fiber, lane, eventTime);

    if (__DEV__) {
      if (enableDebugTracing) {
        if (fiber.mode & DebugTracingMode) {
          const name = getComponentName(fiber.type) || 'Unknown';
          logForceUpdateScheduled(name, lane);
        }
      }
    }

    if (enableSchedulingProfiler) {
      markForceUpdateScheduled(fiber, lane);
    }
  },
};

updateContainer

export function updateContainer(
  element: ReactNodeList,  container: OpaqueRoot,  parentComponent: ?React$Component<any, any>,  callback: ?Function,
): Lane {
  if (__DEV__) {
    onScheduleRoot(container, element);
  }

  const current = container.current;
  const eventTime = requestEventTime();
  if (__DEV__) {
    // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
    if ('undefined' !== typeof jest) {
      warnIfUnmockedScheduler(current);
      warnIfNotScopedWithMatchingAct(current);
    }
  }
  const lane = requestUpdateLane(current);

  if (enableSchedulingProfiler) {
    markRenderScheduled(lane);
  }

  const context = getContextForSubtree(parentComponent);
  if (container.context === null) {
    container.context = context;
  } else {
    container.pendingContext = context;
  }

  if (__DEV__) {
    if (
      ReactCurrentFiberIsRendering &&
      ReactCurrentFiberCurrent !== null &&
      !didWarnAboutNestedUpdates
    ) {
      didWarnAboutNestedUpdates = true;
      console.error(
        'Render methods should be a pure function of props and state; ' +
          'triggering nested component updates from render is not allowed. ' +
          'If necessary, trigger nested updates in componentDidUpdate.\n\n' +
          'Check the render method of %s.',
        getComponentName(ReactCurrentFiberCurrent.type) || 'Unknown',
      );
    }
  }

  const update = createUpdate(eventTime, lane);// 创建更新任务
  // Caution: React DevTools currently depends on this property
  // being called "element".
  update.payload = {element};

  callback = callback === undefined ? null : callback;
  if (callback !== null) {
    if (__DEV__) {
      if (typeof callback !== 'function') {
        console.error(
          'render(...): Expected the last optional `callback` argument to be a ' +
            'function. Instead received: %s.',
          callback,
        );
      }
    }
    update.callback = callback;
  }

  enqueueUpdate(current, update); // 推入更新队列
  scheduleUpdateOnFiber(current, lane, eventTime); // 进行调度

  return lane;
}
  • 我们看到了enqueueSetStateenqueueReplaceStateenqueueForceUpdate还是初始化时候走的updateContainer都是走了几乎一样的逻辑:requestEventTime => requestUpdateLane => createUpdate => enqueueUpdate => scheduleUpdateOnFiber

总结

本章从ReactDOM.render()开始讲解了,初始化的时候,根节点的创建与更新流程,以及在类组件原型上挂载的一些更新的方法,但是为什么这一章不直接把他更新流程讲完呢?因为下一章要讲一下fiberNode这个东西,简而言之他只是一个架构概念,并不是React独有的,但是现在很有必要一起来看一看这个,那么下一章我们来一起揭开FiberNode的神秘面纱吧

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/31577.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

算法入门 | 二叉树的递归遍历、递归创建系列(递归)

目录 1. 二叉树的遍历规则 2. 二叉树的结构体设计 【leftchild data rightchild】 3. 二叉树的递归先序、中序、后序遍历 4. 利用已知字符串&#xff08;二叉树的先序序列&#xff09;递归创建一棵二叉树 &#xff08;1&#xff09;购买节点函数 &#xff08;2&#xff…

【附源码】计算机毕业设计JAVA移动学习网站

【附源码】计算机毕业设计JAVA移动学习网站 目运行 环境项配置&#xff1a; Jdk1.8 Tomcat8.5 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; JAVA mybati…

阻止网络钓鱼诈骗的技巧

根据 Verizon 的2022 年数据泄露调查报告&#xff0c;25% 的数据泄露始终涉及网络钓鱼。 这是怎么发生的&#xff1f;参与网络钓鱼的欺诈者往往是一些掌握发文技巧的内容作者。他们知道如何创造一种紧迫感&#xff0c;让您点击通知并阅读消息。 很多用户落入了他们的陷阱&…

录屏软件哪个好?比较好用的录屏软件,这4款值得一试!

​现在很多人都会使用录屏软件&#xff0c;有些用来录制游戏里的精彩操作&#xff0c;有些用来录制线上的教学课程&#xff0c;有些用来录制在线视频会议。如今录屏软件种类繁多。选择一个好的录屏软件十分重要。录屏软件哪个好&#xff1f;比较好用的录屏软件有哪些&#xff1…

Zebec开启多链布局,流支付生态持续扩张

随着 Do Kwon 的Terra 以及 Sam Bankman-Fried 的 FTX&#xff0c;这两个加密行业的“庞大帝国”轰然倒塌后&#xff0c;Terra生态毁于一旦&#xff0c;而辉煌一时的Solana生态也失去了“靠山”&#xff0c;尤其是在Solana屡次宕机、在FTX危机时增发SOL代币后&#xff0c;进一步…

骨传导耳机会损伤大脑吗?一分钟详细了解骨传导耳机

骨传导耳机会损伤大脑吗&#xff1f;这个问题一直都有很多人在问&#xff0c;相对传统入耳式耳机来说&#xff0c;骨传导耳机更能保护我们的听力与大脑&#xff0c;骨传导耳机的工作原理跟传统耳机不一样&#xff0c;它不会损伤到大脑&#xff0c;下面我来跟大家说一下骨传导耳…

Python: 10大Web框架简介

文章目录简介一、Web 框架三大分类**1. 全栈框架****2.微框架****3.异步框架**二、Python Web 框架的优点三、十大 Python Web 开发框架1.Django2. Flask3.CherryPy4.Pyramid5. Grok6.Turbogears7.Zope38. Bottle9.Web2py10. Tornado小结简介 在这篇文章中了解一些可供您使用的…

dolphinscheduler-data-quality-3.1.0 部署

前提条件 dophinscheduler-3.1.0 安装 standalone-server 模式&#xff0c;参考 https://blog.csdn.net/windydreams/article/details/127678233 编译数据质量源码 为了保障后期正常运行&#xff0c;简化配置&#xff0c;可以进行以下配置 1&#xff09;添加资源文件src/mai…

疫情之下,企业如何才能高效的进行异地协同办公?

随着经济社会的飞速发展再加上现在疫情反反复复的出现&#xff0c;很多公司的业务不再受地域的限制&#xff0c;所以出差就成了很多职场人士的家常便饭&#xff0c;而这一现象也加剧了异地办公模式的兴起&#xff0c;因为即便身处异地&#xff0c;也需要及时向领导汇报工作进度…

防爆定位信标与防爆定位基站有什么区别?

防爆定位信标与防爆定位基站都是组成人员定位系统的硬件设备。一套完整的人员定位系统由硬件设施和软件系统组成&#xff0c;其中硬件设施包括人员定位卡、防爆定位信标和防爆定位基站。 在大数据、信息化时代&#xff0c;基于蓝牙LoRa定位技术的融合定位系统&#xff0c;让我们…

2008-2020年全国各省劳动生产率

2008-2020年全国各省劳动生产率 1、包括&#xff1a;全国31省 2、来源&#xff1a;国J统计局 3、指标包括&#xff1a; 人均受教育年限、劳动生产率、6岁及6岁以上人口数(人口抽样调查)(人)、6岁及6岁以上初中人口数(人口抽样调查)(人)、 6岁及6岁以上大专及以上人口数(人…

机器学习分类方法

1、支持向量机 1.1支持向量机简介&#xff1a; 支持向量机&#xff08;support vector machines, SVM&#xff09;是一种二分类模型&#xff0c;它的基本模型是定义在特征空间上的间隔最大的线性分类器&#xff0c;间隔最大使它有别于感知机&#xff1b;SVM还包括核技巧&…

【教学类-18-02】20221124《蒙德里安“红黄蓝黑格子画”-A4竖版》(大班)

效果展示&#xff1a; 单页效果 多页效果 预设效果 背景需求&#xff1a; 2022年11月23日&#xff0c;作为艺术特色幼儿园&#xff0c;蒙德里安风格装饰在我们幼儿园的环境中。 蒙德里安是几何抽象画派的先驱&#xff0c;以几何图形为绘画的基本元素&#xff0c;与德士堡等创…

Python毕业设计选题推荐

同学们好&#xff0c;这里是海浪学长的毕设系列文章&#xff01; 对毕设有任何疑问都可以问学长哦! 大四是整个大学期间最忙碌的时光,一边要忙着准备考研,考公,考教资或者实习为毕业后面临的就业升学做准备,一边要为毕业设计耗费大量精力。近几年各个学校要求的毕设项目越来越…

释放数据生产力,数据治理要“即时”

近年来&#xff0c;数据成为核心生产要素之后&#xff0c;人们总是期待充分释放数据生产力。但知易行难&#xff0c;如何释放数据生产力&#xff0c;大部分企业却莫衷一是、无所适从。 尤其是针对文档等非结构化数据&#xff0c;工程设计、生物医药、智能制造、金融、教育等行…

关于地方美食的HTML网页设计——地方美食介绍网站 HTML顺德美食介绍 html网页制作代码大全

&#x1f380; 精彩专栏推荐&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb;&#x1f447;&#x1f3fb; ✍️ 作者简介: 一个热爱把逻辑思维转变为代码的技术博主 &#x1f482; 作者主页: 【主页——&#x1f680;获取更多优质源码】 &#x1f393; web前端期末大作业…

SpringBoot 场景开发多面手成长手册

小册介绍 SpringBoot之强大 SpringBoot 的强大之处不言而喻&#xff0c;其底层 SpringFramework 强大的 IOC 容器和 AOP 机制&#xff0c;加之 SpringBoot 的自动装配&#xff0c;使得 SpringBoot 成为当今 JavaEE 开发中最受欢迎、使用范围极其广泛的基本技术。 但是&#x…

高性能队列Disruptor使用教程

目录一、简介二、代码2.1 依赖2.2 角色介绍2.3 事件类2.4 生产者2.5 消费者2.6 启动Disruptor2.7 测试源码一、简介 Disruptor是英国外汇交易公司LMAX开发的一个高性能队列&#xff0c;研发的初衷是解决内存队列的延迟问题&#xff08;在性能测试中发现竟然与I/O操作处于同样的…

【C++】多态/虚表

目录 一、概念 二、虚表工作/运行原理 1.虚函数在一个类内存储的大小 2.对虚函数的访问&#xff08;一维数组&#xff09; 3.单继承 &#xff08;1&#xff09;虚函数继承情况 &#xff08;2&#xff09;单继承存储的大小 &#xff08;3&#xff09;基类子类调用情况 …

Actipro Windows Forms Controls 22.1.3 注册版

Actipro Windows Forms Controls 窗体控件 一组用于构建漂亮的 Windows 窗体桌面应用程序的 UI 控件 语法编辑器 语法高亮代码编辑器控件和解析套件。 为您自己的应用程序带来类似于 Visual Studio 的强大代码编辑体验&#xff0c;以及流行代码编辑器中的所有高级功能。大多数流…