I did a search on this website to avoid duplication, however most of the questions concerned an abstract comparison between an interface and an abstract class.
My question is more about my specific situation, especially my colleague, and I do not agree with the same approach.
I have 3 classes
- Node (Annotation node in the folder structure)
- Folder (contains subfolders and files)
- File
We use a composite template to get all the folders and their permissions for each user / group
Node class, should it be an interface or an abstract class? Folder and File inherit from Node.
In my opinion, I think that Node should be abstract, because File should not have all the methods that Folder has, for example, AddFolder(Node node)
My colleague said itβs better to use an interface for better coding.
Edit: I rewrote my node as follows:
public abstract class Node { public string Name { get; set; } public string FullName { get; set; } public Node Parent { get; set; } public List<PermissionEntry> Permissions { get; set; } protected Node(string fullName) { FullName = fullName; Permissions = new List<PermissionEntry>(); } public void AssignPermission() {
source share