c++ Template vs InheritanceTrying to find a good design for reading in values of different types from a...

Are objects structures and/or vice versa?

Patience, young "Padovan"

Is there a way to make member function NOT callable from constructor?

Symmetry in quantum mechanics

Pristine Bit Checking

What is it called when one voice type sings a 'solo'?

Why was the "bread communication" in the arena of Catching Fire left out in the movie?

What is GPS' 19 year rollover and does it present a cybersecurity issue?

Does a dangling wire really electrocute me if I'm standing in water?

Crop image to path created in TikZ?

New order #4: World

Should the British be getting ready for a no-deal Brexit?

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

How to make particles emit from certain parts of a 3D object?

Can I find out the caloric content of bread by dehydrating it?

Why do UK politicians seemingly ignore opinion polls on Brexit?

Can I legally use front facing blue light in the UK?

Is this food a bread or a loaf?

How can I add custom success page

How can I fix this gap between bookcases I made?

Email Account under attack (really) - anything I can do?

extract characters between two commas?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?



c++ Template vs Inheritance


Trying to find a good design for reading in values of different types from a fileVariant class with full move supportSmart enum templatesArray-like container for uints shorter than 8 bits (Rev 1)JSON C++14 library API/implementationConsole Command module (in-game console or base for script engine)Modular Visitor PatternAssociating a string with a derived classModular graph searcherReplace a #define/template “Variable Wrapper” system with a pure template/OOP solution






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3












$begingroup$


I'm trying to create a node based scripting/computation system.
I've come up with 2 solution that seems to work. One involves template, the other one inheritance. Basically what I want to achieve is: when a node is connected to another node, data computed from the previous node are transferred to the second one. Connection happens through a socket.
The template solution uses a Socket Object to store the data, so it must be a template in order to store every type a user wants to store (Socket). Sockets are stored in every node in a map>
So in order to initialize the Node, I have to use templates to initialize the variant. In the end, what it will happen is every time a new socket type is created, the user must add this type to every template instance.



The inheritance way, don't use socket at all. Instead, use a sequence of "if" to get the correct type based on socket name.



There is a third "ugly way". It's similar to the second. But there is a socket. A Socket interface without interface... Basically, The user inherits from the socket and use it to store the type it needs. The in the Node, in order to retrieve the data, it downcast to the Socket it should be, always based on its name. Since the node user designer should know what each Socket is.



So, in the end, I've come up with this list of pros and cons:



For Template



Pros:




  • Nice API

  • Simple design

  • It respects how my mind structured the library


Cons:




  • As soon the Socket types increase, it increases also the length of the template name. Plus you should remember every place where the template is instantiated and update each instance.


Inheritance



Pros:




  • Naive design


Cons:




  • I don't like it much, it's not how I thought it

  • A lot of Sockets mean a lot of "if" conditions

  • Node connection seems unnatural (but it's hidden to the user)


Template Version:



#include <map>
#include <string>
#include <variant>

template <typename T>
class Socket
{
std::string m_name;
T mValue;

public:
Socket(const std::string &name){m_name = name;}
void setValue(const T &t){mValue = t;}
T getValue(const T &t);
const std::string &getName(){return m_name;}
};

template <typename ...SocketTypes>
class Node
{
using TSocket = std::variant<SocketTypes...>;
public:
template <typename T>
void addSocket(Socket<T> socket){
mSockets.insert(std::pair<std::string, TSocket>(socket.getName(), socket));
}

template < typename Visitor>
auto getSocket(const std::string &name, Visitor visitor){
return std::visit(visitor, mSockets.find(name)->second);
}
private:
std::map<std::string, TSocket> mSockets;

};


using IntSocket = Socket<int>;
using FloatSocket = Socket<float>;


struct DefaultVisitor {
template <typename T>
void operator ()(T &t) {;}
};

// Skip this... it was just to test if it works.
// connection basically gets the value from one socket and pass it to the other
int main() {

Node<IntSocket, FloatSocket> data;
IntSocket i(std::string("value"));
i.setValue(10);
data.addSocket(i);
DefaultVisitor v;
data.getSocket(std::string("value"), v);

}


Inheritance



#include <vector>
#include <string>

struct Node {
int number;
float fNumber;

template <typename T>
void inputConnect(std::string &socket, T value){
if(socket == "r")
number = value;
}

template <typename Object>
void outputConnect(std::string socketIn,
Object &obj, std::string socketOut)
{
if(socketIn == "r")
obj.inputConnect(socketOut, number);
}

};


void connect(Node &n1, std::string socket1,
Node &n2, std::string socket2){

n1.outputConnect(socket1, n2, socket2);

}

int main() {
Node n;
Node n2;
n.number = 10;

connect(n, std::string("r"), n2, std::string("r"));
return n2.number;
}


Help me decide wich is a better solution for my problem.










share|improve this question









New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$












  • $begingroup$
    Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
    $endgroup$
    – pacmaninbw
    yesterday










  • $begingroup$
    done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
    $endgroup$
    – rebellion
    yesterday






  • 1




    $begingroup$
    Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
    $endgroup$
    – Toby Speight
    19 hours ago










  • $begingroup$
    My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
    $endgroup$
    – rebellion
    14 hours ago


















3












$begingroup$


I'm trying to create a node based scripting/computation system.
I've come up with 2 solution that seems to work. One involves template, the other one inheritance. Basically what I want to achieve is: when a node is connected to another node, data computed from the previous node are transferred to the second one. Connection happens through a socket.
The template solution uses a Socket Object to store the data, so it must be a template in order to store every type a user wants to store (Socket). Sockets are stored in every node in a map>
So in order to initialize the Node, I have to use templates to initialize the variant. In the end, what it will happen is every time a new socket type is created, the user must add this type to every template instance.



The inheritance way, don't use socket at all. Instead, use a sequence of "if" to get the correct type based on socket name.



There is a third "ugly way". It's similar to the second. But there is a socket. A Socket interface without interface... Basically, The user inherits from the socket and use it to store the type it needs. The in the Node, in order to retrieve the data, it downcast to the Socket it should be, always based on its name. Since the node user designer should know what each Socket is.



So, in the end, I've come up with this list of pros and cons:



For Template



Pros:




  • Nice API

  • Simple design

  • It respects how my mind structured the library


Cons:




  • As soon the Socket types increase, it increases also the length of the template name. Plus you should remember every place where the template is instantiated and update each instance.


Inheritance



Pros:




  • Naive design


Cons:




  • I don't like it much, it's not how I thought it

  • A lot of Sockets mean a lot of "if" conditions

  • Node connection seems unnatural (but it's hidden to the user)


Template Version:



#include <map>
#include <string>
#include <variant>

template <typename T>
class Socket
{
std::string m_name;
T mValue;

public:
Socket(const std::string &name){m_name = name;}
void setValue(const T &t){mValue = t;}
T getValue(const T &t);
const std::string &getName(){return m_name;}
};

template <typename ...SocketTypes>
class Node
{
using TSocket = std::variant<SocketTypes...>;
public:
template <typename T>
void addSocket(Socket<T> socket){
mSockets.insert(std::pair<std::string, TSocket>(socket.getName(), socket));
}

template < typename Visitor>
auto getSocket(const std::string &name, Visitor visitor){
return std::visit(visitor, mSockets.find(name)->second);
}
private:
std::map<std::string, TSocket> mSockets;

};


using IntSocket = Socket<int>;
using FloatSocket = Socket<float>;


struct DefaultVisitor {
template <typename T>
void operator ()(T &t) {;}
};

// Skip this... it was just to test if it works.
// connection basically gets the value from one socket and pass it to the other
int main() {

Node<IntSocket, FloatSocket> data;
IntSocket i(std::string("value"));
i.setValue(10);
data.addSocket(i);
DefaultVisitor v;
data.getSocket(std::string("value"), v);

}


Inheritance



#include <vector>
#include <string>

struct Node {
int number;
float fNumber;

template <typename T>
void inputConnect(std::string &socket, T value){
if(socket == "r")
number = value;
}

template <typename Object>
void outputConnect(std::string socketIn,
Object &obj, std::string socketOut)
{
if(socketIn == "r")
obj.inputConnect(socketOut, number);
}

};


void connect(Node &n1, std::string socket1,
Node &n2, std::string socket2){

n1.outputConnect(socket1, n2, socket2);

}

int main() {
Node n;
Node n2;
n.number = 10;

connect(n, std::string("r"), n2, std::string("r"));
return n2.number;
}


Help me decide wich is a better solution for my problem.










share|improve this question









New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$












  • $begingroup$
    Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
    $endgroup$
    – pacmaninbw
    yesterday










  • $begingroup$
    done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
    $endgroup$
    – rebellion
    yesterday






  • 1




    $begingroup$
    Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
    $endgroup$
    – Toby Speight
    19 hours ago










  • $begingroup$
    My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
    $endgroup$
    – rebellion
    14 hours ago














3












3








3





$begingroup$


I'm trying to create a node based scripting/computation system.
I've come up with 2 solution that seems to work. One involves template, the other one inheritance. Basically what I want to achieve is: when a node is connected to another node, data computed from the previous node are transferred to the second one. Connection happens through a socket.
The template solution uses a Socket Object to store the data, so it must be a template in order to store every type a user wants to store (Socket). Sockets are stored in every node in a map>
So in order to initialize the Node, I have to use templates to initialize the variant. In the end, what it will happen is every time a new socket type is created, the user must add this type to every template instance.



The inheritance way, don't use socket at all. Instead, use a sequence of "if" to get the correct type based on socket name.



There is a third "ugly way". It's similar to the second. But there is a socket. A Socket interface without interface... Basically, The user inherits from the socket and use it to store the type it needs. The in the Node, in order to retrieve the data, it downcast to the Socket it should be, always based on its name. Since the node user designer should know what each Socket is.



So, in the end, I've come up with this list of pros and cons:



For Template



Pros:




  • Nice API

  • Simple design

  • It respects how my mind structured the library


Cons:




  • As soon the Socket types increase, it increases also the length of the template name. Plus you should remember every place where the template is instantiated and update each instance.


Inheritance



Pros:




  • Naive design


Cons:




  • I don't like it much, it's not how I thought it

  • A lot of Sockets mean a lot of "if" conditions

  • Node connection seems unnatural (but it's hidden to the user)


Template Version:



#include <map>
#include <string>
#include <variant>

template <typename T>
class Socket
{
std::string m_name;
T mValue;

public:
Socket(const std::string &name){m_name = name;}
void setValue(const T &t){mValue = t;}
T getValue(const T &t);
const std::string &getName(){return m_name;}
};

template <typename ...SocketTypes>
class Node
{
using TSocket = std::variant<SocketTypes...>;
public:
template <typename T>
void addSocket(Socket<T> socket){
mSockets.insert(std::pair<std::string, TSocket>(socket.getName(), socket));
}

template < typename Visitor>
auto getSocket(const std::string &name, Visitor visitor){
return std::visit(visitor, mSockets.find(name)->second);
}
private:
std::map<std::string, TSocket> mSockets;

};


using IntSocket = Socket<int>;
using FloatSocket = Socket<float>;


struct DefaultVisitor {
template <typename T>
void operator ()(T &t) {;}
};

// Skip this... it was just to test if it works.
// connection basically gets the value from one socket and pass it to the other
int main() {

Node<IntSocket, FloatSocket> data;
IntSocket i(std::string("value"));
i.setValue(10);
data.addSocket(i);
DefaultVisitor v;
data.getSocket(std::string("value"), v);

}


Inheritance



#include <vector>
#include <string>

struct Node {
int number;
float fNumber;

template <typename T>
void inputConnect(std::string &socket, T value){
if(socket == "r")
number = value;
}

template <typename Object>
void outputConnect(std::string socketIn,
Object &obj, std::string socketOut)
{
if(socketIn == "r")
obj.inputConnect(socketOut, number);
}

};


void connect(Node &n1, std::string socket1,
Node &n2, std::string socket2){

n1.outputConnect(socket1, n2, socket2);

}

int main() {
Node n;
Node n2;
n.number = 10;

connect(n, std::string("r"), n2, std::string("r"));
return n2.number;
}


Help me decide wich is a better solution for my problem.










share|improve this question









New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




I'm trying to create a node based scripting/computation system.
I've come up with 2 solution that seems to work. One involves template, the other one inheritance. Basically what I want to achieve is: when a node is connected to another node, data computed from the previous node are transferred to the second one. Connection happens through a socket.
The template solution uses a Socket Object to store the data, so it must be a template in order to store every type a user wants to store (Socket). Sockets are stored in every node in a map>
So in order to initialize the Node, I have to use templates to initialize the variant. In the end, what it will happen is every time a new socket type is created, the user must add this type to every template instance.



The inheritance way, don't use socket at all. Instead, use a sequence of "if" to get the correct type based on socket name.



There is a third "ugly way". It's similar to the second. But there is a socket. A Socket interface without interface... Basically, The user inherits from the socket and use it to store the type it needs. The in the Node, in order to retrieve the data, it downcast to the Socket it should be, always based on its name. Since the node user designer should know what each Socket is.



So, in the end, I've come up with this list of pros and cons:



For Template



Pros:




  • Nice API

  • Simple design

  • It respects how my mind structured the library


Cons:




  • As soon the Socket types increase, it increases also the length of the template name. Plus you should remember every place where the template is instantiated and update each instance.


Inheritance



Pros:




  • Naive design


Cons:




  • I don't like it much, it's not how I thought it

  • A lot of Sockets mean a lot of "if" conditions

  • Node connection seems unnatural (but it's hidden to the user)


Template Version:



#include <map>
#include <string>
#include <variant>

template <typename T>
class Socket
{
std::string m_name;
T mValue;

public:
Socket(const std::string &name){m_name = name;}
void setValue(const T &t){mValue = t;}
T getValue(const T &t);
const std::string &getName(){return m_name;}
};

template <typename ...SocketTypes>
class Node
{
using TSocket = std::variant<SocketTypes...>;
public:
template <typename T>
void addSocket(Socket<T> socket){
mSockets.insert(std::pair<std::string, TSocket>(socket.getName(), socket));
}

template < typename Visitor>
auto getSocket(const std::string &name, Visitor visitor){
return std::visit(visitor, mSockets.find(name)->second);
}
private:
std::map<std::string, TSocket> mSockets;

};


using IntSocket = Socket<int>;
using FloatSocket = Socket<float>;


struct DefaultVisitor {
template <typename T>
void operator ()(T &t) {;}
};

// Skip this... it was just to test if it works.
// connection basically gets the value from one socket and pass it to the other
int main() {

Node<IntSocket, FloatSocket> data;
IntSocket i(std::string("value"));
i.setValue(10);
data.addSocket(i);
DefaultVisitor v;
data.getSocket(std::string("value"), v);

}


Inheritance



#include <vector>
#include <string>

struct Node {
int number;
float fNumber;

template <typename T>
void inputConnect(std::string &socket, T value){
if(socket == "r")
number = value;
}

template <typename Object>
void outputConnect(std::string socketIn,
Object &obj, std::string socketOut)
{
if(socketIn == "r")
obj.inputConnect(socketOut, number);
}

};


void connect(Node &n1, std::string socket1,
Node &n2, std::string socket2){

n1.outputConnect(socket1, n2, socket2);

}

int main() {
Node n;
Node n2;
n.number = 10;

connect(n, std::string("r"), n2, std::string("r"));
return n2.number;
}


Help me decide wich is a better solution for my problem.







c++ comparative-review inheritance template-meta-programming






share|improve this question









New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









esote

3,02611141




3,02611141






New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









rebellionrebellion

163




163




New contributor




rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






rebellion is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • $begingroup$
    Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
    $endgroup$
    – pacmaninbw
    yesterday










  • $begingroup$
    done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
    $endgroup$
    – rebellion
    yesterday






  • 1




    $begingroup$
    Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
    $endgroup$
    – Toby Speight
    19 hours ago










  • $begingroup$
    My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
    $endgroup$
    – rebellion
    14 hours ago


















  • $begingroup$
    Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
    $endgroup$
    – pacmaninbw
    yesterday










  • $begingroup$
    done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
    $endgroup$
    – rebellion
    yesterday






  • 1




    $begingroup$
    Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
    $endgroup$
    – Toby Speight
    19 hours ago










  • $begingroup$
    My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
    $endgroup$
    – rebellion
    14 hours ago
















$begingroup$
Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
$endgroup$
– pacmaninbw
yesterday




$begingroup$
Welcome to code review. It is unclear what you are asking for, are you asking for a code review or are you asking for opinion on which is better? Please take a look at how to ask a good question codereview.stackexchange.com/help/how-to-ask.
$endgroup$
– pacmaninbw
yesterday












$begingroup$
done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
$endgroup$
– rebellion
yesterday




$begingroup$
done, I just need to know which is better, the code I've posted is some test code I've done on godbolt.org. Thanks for the tip
$endgroup$
– rebellion
yesterday




1




1




$begingroup$
Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
$endgroup$
– Toby Speight
19 hours ago




$begingroup$
Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How to get the best value out of Code Review: Asking Questions for guidance on writing good question titles.
$endgroup$
– Toby Speight
19 hours ago












$begingroup$
My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
$endgroup$
– rebellion
14 hours ago




$begingroup$
My code is so specific that's impossible to use a more "useful title" that can be useful for other people. It's not an algorithm that you can decide it's purpose, but this are two classes abstracting an idea: A Node and a Socket and how to build a framework around them after someone help me decide the best solution for my code.
$endgroup$
– rebellion
14 hours ago










0






active

oldest

votes












Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






rebellion is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217003%2fc-template-vs-inheritance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








rebellion is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















rebellion is a new contributor. Be nice, and check out our Code of Conduct.













rebellion is a new contributor. Be nice, and check out our Code of Conduct.












rebellion is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Code Review Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217003%2fc-template-vs-inheritance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...