开发者

Class and class-helpers

开发者 https://www.devze.com 2023-02-04 06:37 出处:网络
I am new to c++ and want to ask about class helpers. Well, i have a class and i what class helpers to be in 开发者_StackOverflowother file. For that i should use namespaces but then i cant #include t

I am new to c++ and want to ask about class helpers.

Well, i have a class and i what class helpers to be in 开发者_StackOverflowother file. For that i should use namespaces but then i cant #include this file multiple times(because of redefinition).

What is the right way to make class helpers in other classes? Should i use static classes for that?

UPD: Ok i get the fitst part, but should i use namespaces or static classses for class helpers? (I dont really see any benefit of using classes instead if namespaces , but i am a newbie so i am not sure). UPD2: Oh. With a class for this i can make sub-classes for helper class.


use #ifdef to guard against multiple redefinitions.

also look at this post: #pragma once vs include guards?

0

精彩评论

暂无评论...
验证码 换一张
取 消