Mock non-virtual method giving compilation error
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I need to write the gtest to test some existing code that has a non-virtual method, hence I am testing using the below source, but I am getting the compilation error sample_template_class3.cpp #include <iostream> #include <gtest/gtest.h> #include <gmock/gmock.h> using namespace std ; template < class myclass > class Templatemyclass { private : myclass T ; public : void display () { T . display (); } }; class Test { public : void display () { cout << "Inside the display Test:" << endl ; } }; class MockTest { public : MOCK_METHOD0 (