Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need an OOP example  (Read 3133 times)

0 Members and 1 Guest are viewing this topic.

Northenlad60

    Topic Starter


    Rookie

    • Yes
  • Experience: Experienced
  • OS: Windows 7
Need an OOP example
« on: September 23, 2013, 02:18:04 PM »
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.

Thanks

Linux711



    Mentor

    Thanked: 59
    • Yes
    • Programming Blog
  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: Need an OOP example
« Reply #1 on: September 23, 2013, 10:22:17 PM »
I 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.
YouTube

"Genius is persistence, not brain power." - Me

"Insomnia is just a byproduct of, "It can't be done"" - LaVolpe