C++ struct的繼承
发布日期:2021-05-06 19:47:42 浏览次数:24 分类:技术文章

本文共 1200 字,大约阅读时间需要 4 分钟。

C++ struct的繼承

struct的繼承

參考自:

When deriving a struct from a class/struct, default access-specifier for a base class/struct is public. And when deriving a class, default access specifier is private.

當struct繼承時,默認的access specifier是public;而class繼承時,默認的access specifier則是private。

TensorRT/samples/common/argsParser.hCaffeSampleParamsSampleParams的繼承:

struct SampleParams{
int batchSize{
1}; //!< Number of inputs in a batch int dlaCore{
-1}; //!< Specify the DLA core to run network on. bool int8{
false}; //!< Allow runnning the network in Int8 mode. bool fp16{
false}; //!< Allow running the network in FP16 mode. std::vector
dataDirs; //!< Directory paths where sample data files are stored std::vector
inputTensorNames; std::vector
outputTensorNames;};struct CaffeSampleParams : public SampleParams{
std::string prototxtFileName; //!< Filename of prototxt design file of a network std::string weightsFileName; //!< Filename of trained weights file of a network std::string meanFileName; //!< Filename of mean file of a network};

參考連結

上一篇:C getopt.h
下一篇:C++ namespace,extending namespace

发表评论

最新留言

不错!
[***.144.177.141]2025年03月31日 06时29分37秒