0

I understood (or I thought I understood) that a constructor has the name as the class. Then why do I get a "membernames cannot have the same name as their enclosing type here":

namespace p0080
{
    class p0050Access:fwSQL
    {
        void p0050Access()
        {
            this.cConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=v:\\data\\p0050\\p0050.accdb";
        }
    }
}

Edited by PerplexedB

3
Contributors
3
Replies
16
Views
4 Years
Discussion Span
Last Post by PerplexedB
2

Constructors don't have return types (they are returing the object being constructed and the compiler is smart enough to know this) so when you declare it as void, it thinks you are trying to define a method with the same name as the class.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.