If I inherit from a base class and want to pass something from the constructor of the inherited class to the constructor of the base class, how do I do that?
For example,
If I inherit from the Exception class I want to do something like this:
in C# Language we do it like this:
public class CppDynamicSyntaxLanguage : DynamicOutliningSyntaxLanguage
{
public CppDynamicSyntaxLanguage(string key, bool secure) :
**base(key, secure)** {}
}
but how to do it in c++.net ? i try to do it like this :
public ref class CppDynamicSyntaxLanguage : public DynamicOutliningSyntaxLanguage
{
public:
CppDynamicSyntaxLanguage (String ^key, bool secure) :
**CppDynamicSyntaxLanguage(key,secure)** {};
}
but i got Error 'MyEditor::CppDynamicSyntaxLanguage' : illegal member initialization: 'CppDynamicSyntaxLanguage' is not a base or member
"Thank You"
The base class is named DynamicOutliningSyntaxLanguage
, not CppDynamicSyntaxLanguage
.
CppDynamicSyntaxLanguage (String ^key, bool secure)
: DynamicOutliningSyntaxLanguage(key,secure) { };
Did you try:
class CppDynamicSyntaxLanguage: public DynamicOutliningSyntaxLanguage {
public:
CppDynamicSyntaxLanguage(string key, bool secure):
DynamicOutliningSyntaxLanguage(key, secure) {
}
};
It would work in c++, don't know about .net. Assuming DynamicOutliningSyntaxLanguage has a constructor that consumes sting and bool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With