1.

Solve : Need an OOP example?

Answer»

Hi,

I have been given a task for tomorrow to give an example to show an understanding of the following:

1. Object Assignment in OOP
2. Inheritance and interfaces in OOP

As I have not done any OOP development before, I hoped someone give an EXPLANATION in "Laymen's Terms", so I can build on this?

This would be appreciated.

ThanksI don't know what language you're USING, but C# should be CLOSE enough to understand even if you aren't using that language. DotNET Pearls is a very good SITE for OOP C# description and examples.

Inheritance: http://www.dotnetperls.com/inheritance

Interfaces: http://www.dotnetperls.com/interface

Object assignment is very simple:
Code: [Select]myObjectType objectName = new myObjectType(param1, param2, etc);

PUBLIC class myObjectType
{
    public myObjectType(int param1, int param2)
    {
     //this method is executed when class is created using line above
    }

    private doStuff()
    {
    //you can only access this from within this class
    }

    public doStuff()
    {
    //you can access outside this class
    }
}
There are a million other things I could go into, but I think that gives you a good basic idea.



Discussion

No Comment Found