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";
        }
    }
}

Recommended Answers

All 3 Replies

Try this, public p0050Access()

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.

Right... Makes sense. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.