0
Answer

On Usage Of Attributes

Photo of shantanu

shantanu

18y
2.2k
1
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