0

Hello All

I have two classes
1. Employee
2. Project

both classes have a create function

create function of Employee class creates a new Employee
it takes object of Employee class as input parameter and return bool

create function of Project class creates a new Project
it takes object of Project class as input parameter and return bool

Now I want to create a abstract class which will contain a create function
So I can inherit that abstract class into my both above classes

What should be the prototype or signature for that create function of abstract class
Which should be able to take any type of class object?

Any help ???

Thanks in advance

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Ramy Mahrous
0
public abstract class AbsClass
    {
        public abstract void Create();
    }

    public class Employee : AbsClass
    {
        public override void Create()
        {
            throw new NotImplementedException();
        }
    }

    public class Project : AbsClass
    {
        public override void Create()
        {
            throw new NotImplementedException();
        }
    }
0

Hello RamyMahrous,

first thanks for response

when i will call create function for employee or project ,i will pass a object of that type ,so this function should able to take object of both classes,
but above prototype didn't have any input parameter ,so which type of input parameter it should take

thanks

This topic has been dead for over six months. 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.