I need to stop executing constructor
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: I need to stop executing constructor

Hybrid View

  1. #1
    Join Date
    Jun 2012

    I need to stop executing constructor

    PHP Code:
    using namespace System;
    ref class A
    A(){Console::WriteLine(L"A constructor");}
    virtual void func(){foo();}
    void foo()
    Console::WriteLine(L"A from foo");
    ref class A_Mock:public A
    virtual void func() override 

    int main(array<System::String ^> ^args)
    Console::WriteLine(L"Hello World");
    A^b=gcnew A_Mock();

    Supposing that class A is the development code; and so for unit-testing purpose I create a mock for it. But I don't know how to override A's constructor such that it will not get executed in my unit-test code.
    Thank you.

  2. #2
    Join Date
    Apr 1999

    Re: I need to stop executing constructor

    What is this weird stuff?
    int main(array<System::String ^> ^args)
    Seriously, you want the Managed C++ forum, not this one. There is no such keyword as "ref" in ANSI C++ or "gcnew", or any of the "^" stuff in the C++ language.

    This forum is for ANSI C++ using Visual C++, plus use of MFC, ATL libraries. Managed, CLR, or any type of .NET C++ goes in the Managed forum.


    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!

HTML5 Development Center