CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1

    Passing derived class members to base class constructer?

    I'm trying to derive a class from HtmlTextWriter to specifically write Html to a string.
    This means constructing the HtmlTextWriter class with some strings, but as these strings are part of the derived class, I can't pass them to the base class constuctor! Here's my code. Any ideas to get around this?
    Of course I can simply have an instance of HtmlTextWriter within the base class, but then I can't just call all the members of HtmlTextWriter directly in my HtmlStringWriter class.

    public class HtmlStringWriter : HtmlTextWriter
        StringBuilder htmlString;
        StringWriter stringWriter;
        public HtmlStringWriter()
            htmlString = new StringBuilder(); // this will hold the string
            stringWriter = new StringWriter(htmlString);
    Last edited by surfdabbler; May 29th, 2013 at 08:19 PM.

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

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.