Cannot get override method in derived (googlemock-fixture) class with fallback to base fixture class to workMethod of derived class needs to downcast its parameterLow level details of inheritance and polymorphismC++ API design and error handlingoverloading left shift operatorg++ when compile and link multiple fileslinker errors: DLL and inheritanceC++ Class file linkingVisual Studio 2015 C++ Unit TestHow can I check a string parameter in googlemock that is passed as void pointerCompilation of C++ member functions defined outside the class body
Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?
Dual statement category theory
Cross over of arrows in a complex diagram
Is it bad to describe a character long after their introduction?
Does anycast addressing add additional latency in any way?
Row to remove the dotted white border around focused button text
How to write or read powers (math) by words?
Averting Real Women Don’t Wear Dresses
Signing using digital signatures?
Can a US President have someone sent to prison?
If protons are the only stable baryons, why do they decay into neutrons in positron emission?
Bash echo $-1 prints hb1. Why?
MH370 blackbox - is it still possible to retrieve data from it?
How to convert object fill in to fine lines?
Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?
“Faire” being used to mean “avoir l’air”?
How do I spend money in Sweden and Denmark?
How to modify the uneven space between separate loop cuts, while they are already cut?
The difference between Rad1 and Rfd1
How likely is sample A and sample B is from distribution C?
Do 3D printers really reach 50 micron (0.050mm) accuracy?
Zombie diet, why humans?
Generate and graph the Recamán Sequence
Are there any vegetarian astronauts?
Cannot get override method in derived (googlemock-fixture) class with fallback to base fixture class to work
Method of derived class needs to downcast its parameterLow level details of inheritance and polymorphismC++ API design and error handlingoverloading left shift operatorg++ when compile and link multiple fileslinker errors: DLL and inheritanceC++ Class file linkingVisual Studio 2015 C++ Unit TestHow can I check a string parameter in googlemock that is passed as void pointerCompilation of C++ member functions defined outside the class body
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm fairly new to C++, more used to C and python, but google was not my friend this time.
I have a baseclass which implements some googlemock fixtures implemented in 2 generic classes (a baseclass and a parameterized class which derives from that baseclass) and a TEST_P function using the parameterized fixture.
Since the parameterized fixture is used to test 2 implementations I put the fixture-classes and the TEST_P in a baseclass cpp-file (+ hpp file) and the specific parameter-tables in 2 specific cpp files.
This works like a charm.
But... now we want to extend one of the implementations so that it needs a specific implementation of a function which is defined in the generic baseclass. For the other implementation the generic implementation is still correct.
So what I want is to override the generic implementation for only 1 of the 2 test-cpp files.
Initially (without override) I had the following in the hpp:
class MyBaseClass : public ::testing::Test
protected:
// boring fixture setup stuff
virtual void test( void );
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
baseclass.cpp file:
MyBaseClass::test( void )
cout << "This is the baseclass implementation" << std::endl;
...
TEST_P( MyParametrizedBaseClass, TestName )
test();
// other googlemock checks not needed for this question
And in the 2 specific implementations I have just the parameter tables:
std:tr1::tuple< /* parameter definition */ > const TableName[] =
//table implementation
INSTANTIATE_TEST_CASE_P( Name, MyParameterizedBaseClass, ::testing::ValuesIn( TableName ) );
Again up to now this works.
Now for ... lets call it impl_1 ... we want test to do the following (this code does not work since the definition for MyParameterizedBaseClass::test is not found):
impl_1.cpp:
void MyParameterizedBaseClass::test( void )
cout << "This is the impl_1 implementation" << std::endl;
The first thing I did after seeing that the compiler misses the definition of MyParameterizedBaseClass::test was replace MyParameterizedBaseClass with MyBaseClass, but then it sees it as a redefinition (which it indeed is).
So next I googled and found the 'override' key word and adapted the MyParameterizedBaseClass definition so it looks like this:
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
void test( void ) override;
But when I do that I get the error:
Baseclass.hpp:[linenumber]: error: expected ';' before 'override'
And in the specific implementation for impl_1 it still says that no test function is declared in MyParameterizedBaseClass
And if I (knowing up front that it is wrong) put the ';' before 'override' as suggested, I get: error: ISO C++ forbids declaration of 'override' with no type
Next I removed the 'override' keyword and recompiled.
Now the compiler is satisfied, but the linker fails on impl_2 since there I don't have an implementation of MyParameterizedClass::test.
And that is true, since I want to have the default implementation of test for that.
(To complete the description: Yes it works again if I also implement test for MyParameterizedBaseClass in impl_2.cpp)
So my question is: what am I doing wrong?
Environment: Linux with GCC 4.4.2 (pretty old I know, but that is the version my company has)
c++
add a comment |
I'm fairly new to C++, more used to C and python, but google was not my friend this time.
I have a baseclass which implements some googlemock fixtures implemented in 2 generic classes (a baseclass and a parameterized class which derives from that baseclass) and a TEST_P function using the parameterized fixture.
Since the parameterized fixture is used to test 2 implementations I put the fixture-classes and the TEST_P in a baseclass cpp-file (+ hpp file) and the specific parameter-tables in 2 specific cpp files.
This works like a charm.
But... now we want to extend one of the implementations so that it needs a specific implementation of a function which is defined in the generic baseclass. For the other implementation the generic implementation is still correct.
So what I want is to override the generic implementation for only 1 of the 2 test-cpp files.
Initially (without override) I had the following in the hpp:
class MyBaseClass : public ::testing::Test
protected:
// boring fixture setup stuff
virtual void test( void );
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
baseclass.cpp file:
MyBaseClass::test( void )
cout << "This is the baseclass implementation" << std::endl;
...
TEST_P( MyParametrizedBaseClass, TestName )
test();
// other googlemock checks not needed for this question
And in the 2 specific implementations I have just the parameter tables:
std:tr1::tuple< /* parameter definition */ > const TableName[] =
//table implementation
INSTANTIATE_TEST_CASE_P( Name, MyParameterizedBaseClass, ::testing::ValuesIn( TableName ) );
Again up to now this works.
Now for ... lets call it impl_1 ... we want test to do the following (this code does not work since the definition for MyParameterizedBaseClass::test is not found):
impl_1.cpp:
void MyParameterizedBaseClass::test( void )
cout << "This is the impl_1 implementation" << std::endl;
The first thing I did after seeing that the compiler misses the definition of MyParameterizedBaseClass::test was replace MyParameterizedBaseClass with MyBaseClass, but then it sees it as a redefinition (which it indeed is).
So next I googled and found the 'override' key word and adapted the MyParameterizedBaseClass definition so it looks like this:
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
void test( void ) override;
But when I do that I get the error:
Baseclass.hpp:[linenumber]: error: expected ';' before 'override'
And in the specific implementation for impl_1 it still says that no test function is declared in MyParameterizedBaseClass
And if I (knowing up front that it is wrong) put the ';' before 'override' as suggested, I get: error: ISO C++ forbids declaration of 'override' with no type
Next I removed the 'override' keyword and recompiled.
Now the compiler is satisfied, but the linker fails on impl_2 since there I don't have an implementation of MyParameterizedClass::test.
And that is true, since I want to have the default implementation of test for that.
(To complete the description: Yes it works again if I also implement test for MyParameterizedBaseClass in impl_2.cpp)
So my question is: what am I doing wrong?
Environment: Linux with GCC 4.4.2 (pretty old I know, but that is the version my company has)
c++
add a comment |
I'm fairly new to C++, more used to C and python, but google was not my friend this time.
I have a baseclass which implements some googlemock fixtures implemented in 2 generic classes (a baseclass and a parameterized class which derives from that baseclass) and a TEST_P function using the parameterized fixture.
Since the parameterized fixture is used to test 2 implementations I put the fixture-classes and the TEST_P in a baseclass cpp-file (+ hpp file) and the specific parameter-tables in 2 specific cpp files.
This works like a charm.
But... now we want to extend one of the implementations so that it needs a specific implementation of a function which is defined in the generic baseclass. For the other implementation the generic implementation is still correct.
So what I want is to override the generic implementation for only 1 of the 2 test-cpp files.
Initially (without override) I had the following in the hpp:
class MyBaseClass : public ::testing::Test
protected:
// boring fixture setup stuff
virtual void test( void );
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
baseclass.cpp file:
MyBaseClass::test( void )
cout << "This is the baseclass implementation" << std::endl;
...
TEST_P( MyParametrizedBaseClass, TestName )
test();
// other googlemock checks not needed for this question
And in the 2 specific implementations I have just the parameter tables:
std:tr1::tuple< /* parameter definition */ > const TableName[] =
//table implementation
INSTANTIATE_TEST_CASE_P( Name, MyParameterizedBaseClass, ::testing::ValuesIn( TableName ) );
Again up to now this works.
Now for ... lets call it impl_1 ... we want test to do the following (this code does not work since the definition for MyParameterizedBaseClass::test is not found):
impl_1.cpp:
void MyParameterizedBaseClass::test( void )
cout << "This is the impl_1 implementation" << std::endl;
The first thing I did after seeing that the compiler misses the definition of MyParameterizedBaseClass::test was replace MyParameterizedBaseClass with MyBaseClass, but then it sees it as a redefinition (which it indeed is).
So next I googled and found the 'override' key word and adapted the MyParameterizedBaseClass definition so it looks like this:
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
void test( void ) override;
But when I do that I get the error:
Baseclass.hpp:[linenumber]: error: expected ';' before 'override'
And in the specific implementation for impl_1 it still says that no test function is declared in MyParameterizedBaseClass
And if I (knowing up front that it is wrong) put the ';' before 'override' as suggested, I get: error: ISO C++ forbids declaration of 'override' with no type
Next I removed the 'override' keyword and recompiled.
Now the compiler is satisfied, but the linker fails on impl_2 since there I don't have an implementation of MyParameterizedClass::test.
And that is true, since I want to have the default implementation of test for that.
(To complete the description: Yes it works again if I also implement test for MyParameterizedBaseClass in impl_2.cpp)
So my question is: what am I doing wrong?
Environment: Linux with GCC 4.4.2 (pretty old I know, but that is the version my company has)
c++
I'm fairly new to C++, more used to C and python, but google was not my friend this time.
I have a baseclass which implements some googlemock fixtures implemented in 2 generic classes (a baseclass and a parameterized class which derives from that baseclass) and a TEST_P function using the parameterized fixture.
Since the parameterized fixture is used to test 2 implementations I put the fixture-classes and the TEST_P in a baseclass cpp-file (+ hpp file) and the specific parameter-tables in 2 specific cpp files.
This works like a charm.
But... now we want to extend one of the implementations so that it needs a specific implementation of a function which is defined in the generic baseclass. For the other implementation the generic implementation is still correct.
So what I want is to override the generic implementation for only 1 of the 2 test-cpp files.
Initially (without override) I had the following in the hpp:
class MyBaseClass : public ::testing::Test
protected:
// boring fixture setup stuff
virtual void test( void );
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
baseclass.cpp file:
MyBaseClass::test( void )
cout << "This is the baseclass implementation" << std::endl;
...
TEST_P( MyParametrizedBaseClass, TestName )
test();
// other googlemock checks not needed for this question
And in the 2 specific implementations I have just the parameter tables:
std:tr1::tuple< /* parameter definition */ > const TableName[] =
//table implementation
INSTANTIATE_TEST_CASE_P( Name, MyParameterizedBaseClass, ::testing::ValuesIn( TableName ) );
Again up to now this works.
Now for ... lets call it impl_1 ... we want test to do the following (this code does not work since the definition for MyParameterizedBaseClass::test is not found):
impl_1.cpp:
void MyParameterizedBaseClass::test( void )
cout << "This is the impl_1 implementation" << std::endl;
The first thing I did after seeing that the compiler misses the definition of MyParameterizedBaseClass::test was replace MyParameterizedBaseClass with MyBaseClass, but then it sees it as a redefinition (which it indeed is).
So next I googled and found the 'override' key word and adapted the MyParameterizedBaseClass definition so it looks like this:
class MyParametrizedBaseClass:
public MyBaseClass,
public::testing::WithParmInterface< std:tr1::tuple< /* parameter definition */ > >
protected:
// some custom assert method definitions
void test( void ) override;
But when I do that I get the error:
Baseclass.hpp:[linenumber]: error: expected ';' before 'override'
And in the specific implementation for impl_1 it still says that no test function is declared in MyParameterizedBaseClass
And if I (knowing up front that it is wrong) put the ';' before 'override' as suggested, I get: error: ISO C++ forbids declaration of 'override' with no type
Next I removed the 'override' keyword and recompiled.
Now the compiler is satisfied, but the linker fails on impl_2 since there I don't have an implementation of MyParameterizedClass::test.
And that is true, since I want to have the default implementation of test for that.
(To complete the description: Yes it works again if I also implement test for MyParameterizedBaseClass in impl_2.cpp)
So my question is: what am I doing wrong?
Environment: Linux with GCC 4.4.2 (pretty old I know, but that is the version my company has)
c++
c++
edited Mar 25 at 11:54
Nemelis
asked Mar 25 at 11:48
NemelisNemelis
8621 gold badge7 silver badges18 bronze badges
8621 gold badge7 silver badges18 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Adding declaration in MyParametrizedBaseClass
was a good move.
Problem is that you have used C++11 feature override
and based on code like this:
std:tr1::tuple< /* parameter definition */ >
(tr1
) indicates that you are using C++03 with "technical report one", so keyword override
is unknown. That is why compiler complains: error: expected ';' before 'override'
So just remove override
keyword and it should be fine.
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definitionvoid MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.
– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implementMyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.
– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.
– Marek R
Mar 25 at 13:03
add a comment |
Your Answer
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: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55337124%2fcannot-get-override-method-in-derived-googlemock-fixture-class-with-fallback-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Adding declaration in MyParametrizedBaseClass
was a good move.
Problem is that you have used C++11 feature override
and based on code like this:
std:tr1::tuple< /* parameter definition */ >
(tr1
) indicates that you are using C++03 with "technical report one", so keyword override
is unknown. That is why compiler complains: error: expected ';' before 'override'
So just remove override
keyword and it should be fine.
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definitionvoid MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.
– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implementMyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.
– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.
– Marek R
Mar 25 at 13:03
add a comment |
Adding declaration in MyParametrizedBaseClass
was a good move.
Problem is that you have used C++11 feature override
and based on code like this:
std:tr1::tuple< /* parameter definition */ >
(tr1
) indicates that you are using C++03 with "technical report one", so keyword override
is unknown. That is why compiler complains: error: expected ';' before 'override'
So just remove override
keyword and it should be fine.
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definitionvoid MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.
– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implementMyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.
– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.
– Marek R
Mar 25 at 13:03
add a comment |
Adding declaration in MyParametrizedBaseClass
was a good move.
Problem is that you have used C++11 feature override
and based on code like this:
std:tr1::tuple< /* parameter definition */ >
(tr1
) indicates that you are using C++03 with "technical report one", so keyword override
is unknown. That is why compiler complains: error: expected ';' before 'override'
So just remove override
keyword and it should be fine.
Adding declaration in MyParametrizedBaseClass
was a good move.
Problem is that you have used C++11 feature override
and based on code like this:
std:tr1::tuple< /* parameter definition */ >
(tr1
) indicates that you are using C++03 with "technical report one", so keyword override
is unknown. That is why compiler complains: error: expected ';' before 'override'
So just remove override
keyword and it should be fine.
answered Mar 25 at 12:12
Marek RMarek R
14.5k2 gold badges29 silver badges79 bronze badges
14.5k2 gold badges29 silver badges79 bronze badges
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definitionvoid MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.
– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implementMyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.
– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.
– Marek R
Mar 25 at 13:03
add a comment |
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definitionvoid MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.
– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implementMyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.
– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.
– Marek R
Mar 25 at 13:03
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
I tried that and the compiler likes it. But the linker does not since it misses in that case the MyParemeterizedBaseClass implementation of test for the implementation that still should use the default implementation (impl_2.cpp)
– Nemelis
Mar 25 at 12:16
do you have definition
void MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.– Marek R
Mar 25 at 12:18
do you have definition
void MyParameterizedBaseClass::test( void )
? If yes and you have still linker issue, do a rebuild or clean before building.– Marek R
Mar 25 at 12:18
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
In the header I now have that. I will try doing a clean build.
– Nemelis
Mar 25 at 12:25
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implement
MyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.– Nemelis
Mar 25 at 12:28
Still fails on the linker (which is probably also old, knowing my company). I'm probably forced to implement
MyParameterizedBaseClass::test
for impl_2.cpp as well and let that implementation call the MyBaseClass implementation. Drawback of that is that whenever there comes an impl_3.cpp we are forced to this implemenation <sad face>. @MarekR: thanx for your help.– Nemelis
Mar 25 at 12:28
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.– Marek R
Mar 25 at 13:03
In the header I now have that.
this is a problem. You can't have this kind of definitions of methods in headers (there are some exceptions). This will end with linker double definition issue.– Marek R
Mar 25 at 13:03
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55337124%2fcannot-get-override-method-in-derived-googlemock-fixture-class-with-fallback-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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