By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Whether Attributes can help in this situation ?

P: 3
Hi,,

I have one following question that whether attributes can help me in resolving this problem:

I have one base class called Employee
and I have 3 classes which inherit it:
EmployeeA
EmployeeB
EmployeeC


Now, the base Employee class contain 3 methods:
void funct1() : needed for EmployeeA & EmployeeB
void funct2() : needed for EmployeeB & EmployeeC
void funct3() : needed for EmployeeC & EmployeeA


Since all the above three methods will be protected in base class, each of them can be called by any inherited class.

Now, I wanted to know, if I can use attributes here for these 3 methods, which will throw an error if the function is called from the wrong class, for e.g., if funct1() is called from EmployeeC it should give a compile time error.

Would really appreciate any help in this regards.

Warm regards,
Shantanu
Mar 21 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.