home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / FL_VCBase_cpp________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2001-08-21  |  1.5 KB  |  43 lines

  1. /*=====================================================================
  2.   File:      VCBase.cpp
  3.  
  4.   Summary:   Demonstrates a simple abstract base class written in C++.
  5.              The remaining modules in this sample show classes that 
  6.              derive from this base class, but are written in Visual
  7.              Basic, C#, and IL.
  8.  
  9. ---------------------------------------------------------------------
  10.   This file is part of the Microsoft .NET SDK Code Samples.
  11.  
  12.   Copyright (C) Microsoft Corporation.  All rights reserved.
  13.  
  14. This source code is intended only as a supplement to Microsoft
  15. Development Tools and/or on-line documentation.  See these other
  16. materials for detailed information regarding Microsoft code samples.
  17.  
  18. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  19. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  20. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  21. PARTICULAR PURPOSE.
  22. =====================================================================*/
  23.  
  24. #using <mscorlib.dll>
  25. using namespace System;
  26.  
  27. __gc public class VCBase
  28. {
  29. protected:
  30.    VCBase(){
  31.       Console::WriteLine(" Executing the VCBase::VCBase() constructor");
  32.    }
  33.     
  34. public:
  35.    virtual void Method() = 0;
  36.    void MethodThatThrows(){
  37.       // Pretend that this code just tried to access some resource
  38.       // that was not available (rather than an explicit throw)
  39.       throw(new OutOfMemoryException("We are out of some resource!"));
  40.    }
  41.  
  42. };
  43.