Using inheritance
===

I have classA that has some variables declared in its .h file (arrays, strings, etc), and in its .m file it has methods that preform operations on these variables.

I am about to create classB, which is going to need all the same methods in its .m, and most of the same variables in its .h.

I have been doing reading but am still confused.  I know I need to use inheritance, but I am not sure exactly how.

What I think I need to do:


**classA.h**

    @interface classA{
    NSMutableArray *myArray;
    NSString *myString;
    }

**classA.m**

    #import classA.h
    @implementation classA
    
    -(void)displayArray{
    for(int x = 0; count < [myArray count], x++){
    NSLog(@"%@", [myArray objectAtIndex:x];
    }

**classB.h**

    #import "classA.h"
    @interface classB{
    }


**classB.m**

    #import "classB.h"
    #import "classA.m"
    @implementation classB
    
    -(void)viewDidLoad{
    [self displayArray];
    }


I want classB to have its own `myArray` and then when `displayArray` is called in classB, it would display classB's `myArray`.  And I need to repeat this for many more classes, but I am just trying to get it work with A and B right now.

Thanks.


---

Edit:  I just made up this example, it is not the actual code.