473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Abstract Class giving error

Hello Everyone,
This is my first attempt at coding using an abstract class and i am
getting an error i can't figure out. Here is the back ground.

I have a project that contains an abstract class, it's namespace is
CIG.Intranet.Co mmons.User and it has 2 methods in it
public abstract getPropertiesHa sh (string userName) and
public abstract getPropertiesXm l (string userName) adn the class name
is called
CPUser.cs

I have a project that contains 2 implementation classes, their
namespace is
CIG.Intranet.Sh arePoint.User this project references the abstact class
and inherits from it and they both contain the methods
public override Hashtable getPropertiesHa sh(string userName) and
public override XmlNode getPropertiesXm l(string userName) the class
names are
Sharepoint2003U ser.cs and
Sharepoint2001U ser.cs and the headers are as follows

public class SharePoint2001U ser : CPUser
public class SharePoint2003U ser : CPUser

I have a project that contains a test form, this project references
both the abstract and implementation class and has code to actually
test these classes. the code is as follows

CPUser user;
user = new SharePoint2003U ser();

Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));

If i have just the first 2 lines in this class and run it everything is
fine, once i add the line that uses the method i get a
MissingMethodEx ception and it says it can't find the getPropertiesXm l
method, if i try and use the getPropertiesHa sh method i also get the
MissingMethodEx ception... i should also note that my intellisence shows
both of these methods.

I tried creating a very simple test app and followed the same procedure
i did as above and it worked fine... i have no idea how to fix this or
what is wrong. can anybody PLEASE help me??

Thanks so much in advance!!!!!

Nov 17 '05 #1
7 1723
How about:

SharePoint2003U ser user;
user = new SharePoint2003U ser();

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

<er************ @cowaninsurance group.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello Everyone,
This is my first attempt at coding using an abstract class and i am
getting an error i can't figure out. Here is the back ground.

I have a project that contains an abstract class, it's namespace is
CIG.Intranet.Co mmons.User and it has 2 methods in it
public abstract getPropertiesHa sh (string userName) and
public abstract getPropertiesXm l (string userName) adn the class name
is called
CPUser.cs

I have a project that contains 2 implementation classes, their
namespace is
CIG.Intranet.Sh arePoint.User this project references the abstact class
and inherits from it and they both contain the methods
public override Hashtable getPropertiesHa sh(string userName) and
public override XmlNode getPropertiesXm l(string userName) the class
names are
Sharepoint2003U ser.cs and
Sharepoint2001U ser.cs and the headers are as follows

public class SharePoint2001U ser : CPUser
public class SharePoint2003U ser : CPUser

I have a project that contains a test form, this project references
both the abstract and implementation class and has code to actually
test these classes. the code is as follows

CPUser user;
user = new SharePoint2003U ser();

Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));

If i have just the first 2 lines in this class and run it everything is
fine, once i add the line that uses the method i get a
MissingMethodEx ception and it says it can't find the getPropertiesXm l
method, if i try and use the getPropertiesHa sh method i also get the
MissingMethodEx ception... i should also note that my intellisence shows
both of these methods.

I tried creating a very simple test app and followed the same procedure
i did as above and it worked fine... i have no idea how to fix this or
what is wrong. can anybody PLEASE help me??

Thanks so much in advance!!!!!

Nov 17 '05 #2
Hard to say given the lack of real code in your message. I've tried to
piece together what you're described, and come up with this, which works as
expected:

public abstract class CPUser
{
public abstract Hashtable getPropertiesHa sh (string userName);
public abstract XmlNode getPropertiesXm l (string userName) ;
}

public class SharePoint2001U ser : CPUser
{
public override Hashtable getPropertiesHa sh(string userName)
{
Console.WriteLi ne("SharePoint2 001User.getProp ertiesHash({0}) ", userName);
return new Hashtable();
}
public override XmlNode getPropertiesXm l(string userName)
{
Console.WriteLi ne("SharePoint2 001User.getProp ertiesXml({0})" , userName);
return new XmlDocument();
}
}

public class SharePoint2003U ser : CPUser
{
public override Hashtable getPropertiesHa sh(string userName)
{
Console.WriteLi ne("SharePoint2 003User.getProp ertiesHash({0}) ", userName);
return new Hashtable();
}
public override XmlNode getPropertiesXm l(string userName)
{
Console.WriteLi ne("SharePoint2 003User.getProp ertiesXml({0})" , userName);
return new XmlDocument();
}
}

public class MyClass
{
public static void Main()
{

CPUser user;
user = new SharePoint2003U ser();

Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));
}
}
<er************ @cowaninsurance group.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hello Everyone,
This is my first attempt at coding using an abstract class and i am
getting an error i can't figure out. Here is the back ground.

I have a project that contains an abstract class, it's namespace is
CIG.Intranet.Co mmons.User and it has 2 methods in it
public abstract getPropertiesHa sh (string userName) and
public abstract getPropertiesXm l (string userName) adn the class name
is called
CPUser.cs

I have a project that contains 2 implementation classes, their
namespace is
CIG.Intranet.Sh arePoint.User this project references the abstact class
and inherits from it and they both contain the methods
public override Hashtable getPropertiesHa sh(string userName) and
public override XmlNode getPropertiesXm l(string userName) the class
names are
Sharepoint2003U ser.cs and
Sharepoint2001U ser.cs and the headers are as follows

public class SharePoint2001U ser : CPUser
public class SharePoint2003U ser : CPUser

I have a project that contains a test form, this project references
both the abstract and implementation class and has code to actually
test these classes. the code is as follows

CPUser user;
user = new SharePoint2003U ser();

Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));

If i have just the first 2 lines in this class and run it everything is
fine, once i add the line that uses the method i get a
MissingMethodEx ception and it says it can't find the getPropertiesXm l
method, if i try and use the getPropertiesHa sh method i also get the
MissingMethodEx ception... i should also note that my intellisence shows
both of these methods.

I tried creating a very simple test app and followed the same procedure
i did as above and it worked fine... i have no idea how to fix this or
what is wrong. can anybody PLEASE help me??

Thanks so much in advance!!!!!

Nov 17 '05 #3
Hey Kevin,
Thanks so much for your reply, i have tried this approach as well and
it also throws the same error. Are there other reasons to why it would
give this error other than that there is a missing method? I don't know
what to do because i've tried recreating my test project many times and
i've tried scaling down the abstract and implementation projects to
bare bones and i still get this error.
Thanks

Nov 17 '05 #4

<er************ @cowaninsurance group.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Hey Kevin,
Thanks so much for your reply, i have tried this approach as well and
it also throws the same error. Are there other reasons to why it would
give this error other than that there is a missing method? I don't know
what to do because i've tried recreating my test project many times and
i've tried scaling down the abstract and implementation projects to
bare bones and i still get this error.
Thanks


Post the Barebones implementation to the group and we will find the problem faster.
It should REALLY be barebones though.

Bill
Nov 17 '05 #5
ok here goes.
A few things to note. The abstract class -CIG.Intranet.Co mmons.User is
in it's own project. The implementation class
CIG.Intranet.Sh arepoint.User is in it's own project and the test
project is in it's own project. I have tried adding the projects under
one solution and also just having a reference to the dll and both ways
i still get the same error.

Thanks
The abstract class -

using System;
using System.Xml;
using System.Collecti ons;

namespace CIG.Intranet.Co mmons.User
{
/// <summary>
/// Summary description for CPUser.
/// </summary>
public abstract class CPUser
{
public CPUser()
{
//
// TODO: Add constructor logic here
//
}

public abstract Hashtable getPropertiesHa sh(string userName);
public abstract XmlNode getPropertiesXm l(string userName);
}
}
The implementation class (SharePoint2003 User) - the one i use in my
example

using System;
using CIG.Intranet.Co mmons.User;
using System.Xml;
using System.IO;
using System.Collecti ons;
using Microsoft.Share Point;
using Microsoft.Share Point.Portal;
using Microsoft.Share Point.Portal.To pology;
using Microsoft.Share Point.Portal.Us erProfiles;

using CIG.Intranet.Sh arePoint.Common s;

namespace CIG.Intranet.Sh arePoint.User
{
/// <summary>
/// Summary description for SharePoint2003U ser.
/// </summary>
public class SharePoint2003U ser : CPUser
{
public SharePoint2003U ser() : base()
{
//
// TODO: Add constructor logic here
//
}

public override Hashtable getPropertiesHa sh(string userName)
{
return null;
}
public override XmlNode getPropertiesXm l(string userName)
{
return null;
}
}
}

the implementation class (SharePoint2001 User) - i am using 2003 in my
example but i put this here just in case..

using System;
using System.Xml;
using System.Collecti ons;
using CIG.Intranet.Co mmons.User;
using CIG.Intranet.Sh arePoint.Common s;

namespace CIG.Intranet.Sh arePoint.User
{
/// <summary>
/// Summary description for SharePoint2001U ser.
/// </summary>
public class SharePoint2001U ser : CPUser
{
public SharePoint2001U ser() : base()
{
//
// TODO: Add constructor logic here
//
}

public override Hashtable getPropertiesHa sh(string userName)
{
return null;
}

public override XmlNode getPropertiesXm l(string userName)
{
return null;
}
}
}
My test project -

using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
using CIG.Intranet.Sh arePoint.User;
using CIG.Intranet.Co mmons.User;

namespace testUser
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();

//
// TODO: Add any constructor code after InitializeCompo nent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.button1 = new System.Windows. Forms.Button();
this.SuspendLay out();
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(16, 16);
this.button1.Na me = "button1";
this.button1.Ta bIndex = 0;
this.button1.Te xt = "Press Me!!!!";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(112, 61);
this.Controls.A dd(this.button1 );
this.Name = "Form1";
this.Text = "TEST";
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
Application.Run (new Form1());
}
catch(Exception e)
{
Console.WriteLi ne(e.Message);
}
}

private void button1_Click(o bject sender, System.EventArg s e)
{
SharePoint2003U ser user;
user = new SharePoint2003U ser();
Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));
}
}
}

Nov 17 '05 #6
If I put all this code into one file, it runs fine. I'm gonna guess
that you actually have it in multiple assemblies, and further guess that you
have an older version of one of them that's being loaded at runtime instead
of the new version.

<er************ @cowaninsurance group.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
ok here goes.
A few things to note. The abstract class -CIG.Intranet.Co mmons.User is
in it's own project. The implementation class
CIG.Intranet.Sh arepoint.User is in it's own project and the test
project is in it's own project. I have tried adding the projects under
one solution and also just having a reference to the dll and both ways
i still get the same error.

Thanks
The abstract class -

using System;
using System.Xml;
using System.Collecti ons;

namespace CIG.Intranet.Co mmons.User
{
/// <summary>
/// Summary description for CPUser.
/// </summary>
public abstract class CPUser
{
public CPUser()
{
//
// TODO: Add constructor logic here
//
}

public abstract Hashtable getPropertiesHa sh(string userName);
public abstract XmlNode getPropertiesXm l(string userName);
}
}
The implementation class (SharePoint2003 User) - the one i use in my
example

using System;
using CIG.Intranet.Co mmons.User;
using System.Xml;
using System.IO;
using System.Collecti ons;
using Microsoft.Share Point;
using Microsoft.Share Point.Portal;
using Microsoft.Share Point.Portal.To pology;
using Microsoft.Share Point.Portal.Us erProfiles;

using CIG.Intranet.Sh arePoint.Common s;

namespace CIG.Intranet.Sh arePoint.User
{
/// <summary>
/// Summary description for SharePoint2003U ser.
/// </summary>
public class SharePoint2003U ser : CPUser
{
public SharePoint2003U ser() : base()
{
//
// TODO: Add constructor logic here
//
}

public override Hashtable getPropertiesHa sh(string userName)
{
return null;
}
public override XmlNode getPropertiesXm l(string userName)
{
return null;
}
}
}

the implementation class (SharePoint2001 User) - i am using 2003 in my
example but i put this here just in case..

using System;
using System.Xml;
using System.Collecti ons;
using CIG.Intranet.Co mmons.User;
using CIG.Intranet.Sh arePoint.Common s;

namespace CIG.Intranet.Sh arePoint.User
{
/// <summary>
/// Summary description for SharePoint2001U ser.
/// </summary>
public class SharePoint2001U ser : CPUser
{
public SharePoint2001U ser() : base()
{
//
// TODO: Add constructor logic here
//
}

public override Hashtable getPropertiesHa sh(string userName)
{
return null;
}

public override XmlNode getPropertiesXm l(string userName)
{
return null;
}
}
}
My test project -

using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
using CIG.Intranet.Sh arePoint.User;
using CIG.Intranet.Co mmons.User;

namespace testUser
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();

//
// TODO: Add any constructor code after InitializeCompo nent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.button1 = new System.Windows. Forms.Button();
this.SuspendLay out();
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(16, 16);
this.button1.Na me = "button1";
this.button1.Ta bIndex = 0;
this.button1.Te xt = "Press Me!!!!";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(112, 61);
this.Controls.A dd(this.button1 );
this.Name = "Form1";
this.Text = "TEST";
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
Application.Run (new Form1());
}
catch(Exception e)
{
Console.WriteLi ne(e.Message);
}
}

private void button1_Click(o bject sender, System.EventArg s e)
{
SharePoint2003U ser user;
user = new SharePoint2003U ser();
Console.WriteLi ne(user.getProp ertiesXml("cigd ev\\sharepoint" ));
}
}
}

Nov 17 '05 #7
Your Guess is correct James.... I just realized that another programmer
had been using a common file in one of the projects and had dragged the
dll into the GAC. This caused all the ruckus, thanks for ALL OF YOUR
HELP!!! i really appreciate it!
Erin

Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2255
by: Vishal Gandhi | last post by:
Hi , Please help me by advising an real life scenario where Abstract Classes should be used over Interfaces or vice versa . Whats the basic difference between Abstract Class and interface other then instantiation ? Many Thanks Vishal Gandhi
3
3923
by: New Comer | last post by:
Can somebody compare Abstract Class and Interface for me? Thanks
6
5793
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove the need to have abstract class types in C#? Derived classes from abstract base classes must overrided the abstract method defininition anyway,...
17
3550
by: baibaichen | last post by:
i have written some code to verify how to disable slicing copy according C++ Gotchas item 30 the follow is my class hierarchy, and note that B is abstract class!! class B { public: explicit B(INT32 i =0):i_(i){} virtual ~B(){}
9
5491
by: silversurfer2025 | last post by:
Hello everyone, I am currently having problems with a C++ abstract class. I have a class FrameWork.h which defines some methods (of which some are abstract, i.e. virtual void method() = 0). In FrameWork.cpp I define some of the methods while I naturally leave the abstract methods undefined. Now I wrote a class FrameWork_GUI.h which inherits...
0
2666
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never looked for one on the net (I did browse the boost library though). It doesn't matter right now, anyway. To put it simply, Abstract Iterator is...
52
20834
by: Ben Voigt [C++ MVP] | last post by:
I get C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not implement interface member 'UselessJunkForDissassembly.IInvocableInternals.OperationValidate(string)' C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27): error CS0535:...
17
3512
by: Jess | last post by:
Hello, If I have a class that has virtual but non-pure declarations, like class A{ virtual void f(); }; Then is A still an abstract class? Do I have to have "virtual void f() = 0;" instead? I think declaring a function as "=0" is the same
1
6416
by: jainchar | last post by:
hello i m in trouble that my project is in vc++ with mfc.my program giving the error that error c2259:"CException" cannot instantiate abstract class. when i remove this error then my project is giving the error in file afxres.rc .according to the error when i remove it and compile or debug the project then this can't save.so what should...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.