Click here to Skip to main content
15,891,372 members
Everything / OOP

OOP

OOP

Great Reads

by Afzaal Ahmad Zeeshan
This post attempts to describe the general difference between overloading and overriding in Object-oriented programming languages.
by Giovanni Scerra
Patterns to prevent null reference exceptions
by Giovanni Scerra
An introduction to transparency in software design, with particular focus on OO languages
by Mahmoud Samir Fayed
Defining Natural Languages in the Ring programming language based on Object-Oriented Programming

Latest Articles

by Yochai Timmer
A way to avoid JNI's reflection oriented programming. Wrapping Java with C++
by Alex Rakov, Alexandre Bencz
ELENA is a general-purpose, object-oriented, polymorphic language with late binding
by Bohdan Stupak
A look at what dynamic polymorphism is and how it is crucial to mastering OOP
by Bohdan Stupak
"Method can be static" Microsoft Code Analysis warning may hide a violation of object-oriented design

All Articles

Sort by Updated

OOP 

5 Sep 2022 by #ODSDOMS
The class has the following methods: - A constructor with one tuple argument called coefficients to define and initialize two instant variables, a and b, with default values of 0. - getCoff method that returns a tuple of...
14 Mar 2011 by #realJSOP
Look at this codeproject article:Exception Handling Best Practices in .NET[^]
7 Apr 2011 by #realJSOP
There is no "better" way to do it. Here are my personal rules0) If you are bound by coding guidelines relating to constructors, follow them. Period.Otherwise...1) If you are editing an existing file, follow the coding style used in the file2) If you are creating a new file, do...
9 Dec 2011 by #realJSOP
When you want to add different or additional functionality with the same method call. A good example would be ToString(). When you can a collection of objects that you want to display in a listbox (or other list container), you can simply override the Object.ToString() method to return the...
29 Dec 2011 by #realJSOP
There is no real order of importance. To code in .Net, you have to understand the framework.The key isn't learning everything - the key is learning everything you need to learn, as soon as the requirement presents itself. Pretty soon, you'll know a lot about everything. In the biz, we call...
9 Jan 2017 by #realJSOP
The answer is - QA is not the place to have programming discussions. Use the various forums that exist on the site.
9 Mar 2018 by #realJSOP
Google is your friend: c# object defaults - Google Search[^]
15 Jul 2018 by #realJSOP
Before the new item is added, do something like this: var found = mycollection.FirstOrDefault(x=>x.name == text); if (found == null) { mycollection.Add(text); } else { MessageBox.Show(“Duplicate names are not allowed.”); }
29 Dec 2011 by 01.mandar
File1.csna...
22 Feb 2022 by 1298201
#include #include // FUNCTIONS void menu(); void account(int option); using namespace std; string AccountType[] = {"", "CHECKINGS", "SAVINGS"}; string response; int AccountDetails[] = { 1234, // pin number 10000, //...
7 Oct 2014 by 1rambo12
Hii All,I am VB Coder Developing Web Applications.Today the industries want only C#. Plz, provide useful links of sample "Web Application Project with C# clearing all OOPs concept. with database operation also."It's will be great HELP. Thank's in Advance.
3 Jul 2012 by 2irfanshaikh
Make the Products property to return List of Productsi.e public virtual List ProductsChange public List getProducts(Category category) as static method and only allow to pass categoryID as parameter.i.e. public static List GetProducts(int...
2 Apr 2015 by 9000605667
I have a class A with 3 methods M1,M2,M3.Class B is inherited from Class A & Class C is inherited from Class B.Now all the methods in Class A are accessible for Class B & Class C.Now i want to restrict 1)M1 & M2 of Class A for Class B2)M3 for Class C .How can i do this.
1 Aug 2012 by _Amy
Since you are using inheritance here, you don't need to create the object of ClassA. In the case of inheritance all the methods of Parent Class (in your case ClassA) will be accessible in child class(in your case ClassB). Hence, you can directly call the function of ClassA in ClassB,...
27 May 2013 by _Amy
Hi,Yes, if the control on the page is rendered before the ScriptManager in the UserControl, this error will be raised.See the similar solution here[^].--Amit
20 May 2015 by _Asif_
You need to flush the buffer before using getline. Check this[^] for reference!
14 Feb 2015 by _GP
For future use and answers, use this pattern:http://en.wikipedia.org/wiki/Command_patternDesign patterns are hard at start. The key is to pick the parts in the question. It says switch on or off. Even if I do or don't know the pattern, I would take the switch part and go through all the...
13 Feb 2013 by _Maxxx_
Your $drums is actually a drum set, not a collection of drums, isn't it? So should you not be adding each cymbal to that collection rather than adding cymbal to a collection of cymbals then adding that collection to the drum set?So I would have a Drum Set to which I add each drum and...
14 Feb 2013 by _Maxxx_
It is not possible to answer your question sensibly;Your pseudo code will always return true given the info you have given.if you can add a drum kit to a cymbal, could you also add a cymbal to a cymbal, or a drum to a cymbal? Your Cymbal object seems to act both as an individual and a...
5 Nov 2011 by Abdul HANAN
Any one can Suggest me OOP project.i hve 1 and a half month 4 this project, so if project is DIfficult then it dosnt mater...
17 Nov 2011 by Abdul HANAN
i chose my project.that is BIG integer, in this project we have to made such an integer variable of 8, 16, 32 .....bytes. This project is suggested by senior student. i really thankful to all of u.
13 Feb 2011 by Abdul Quader Mamun
Thank you for your question.Encapsulation is hiding implementation from end user. Example:String str1="Hello";Console.Write(str1.Length); In the above example, str1 String instance object hide implementation details of Length from client.Abstraction is everything that need...
17 Dec 2013 by Abdur Rashid
When to use an Abstract Class and an Interface?
22 Dec 2013 by Abdur Rashid
For some odd reason, work allows me to handle phone screens and interviews. Each time I give an interview, I try to do three things. First I ask them about general programming questions. This might be OO questions. It might be methodology questions. It might be design pattern questions. Next I...
3 Feb 2011 by Abhinav S
See Abstract Class Vs Interface[^]Abstract Class versus Interface[^]
24 Mar 2011 by Abhinav S
You need to stop thinking in terms of subroutines and think in terms of objects.Then you need to practise, that is the only way.
10 Apr 2011 by Abhinav S
Function overloading allows you to create different methods with the same name.So basically, I can call the same method and based on my requirement (and implementation) the right method is automatically called.For e.g. I can have two overloaded methods GetName(string firstname) and...
28 May 2011 by Abhinav S
There is an absolute beginner series (with videos) on msdn[^].
10 Jul 2011 by Abhinav S
That is the whole idea behind static.Any static method can be accessible without using an instance.
22 Jul 2011 by Abhinav S
Looks like the server you were using has gone out of service and is down.
17 Oct 2011 by Abhinav S
In the first case you have not intantiated the object. As a result, you only have access to the classes static methods.Ine the second case, you are actually allocating a location for an instance in memory. You are actually creating an object of that class. This is what you would do in OOPS....
21 Oct 2011 by Abhinav S
Encapsulation is essentially "data hiding".A class is a construct that can be instantiated to create objects in memory. The class will use encapsulation (e.g. public and private methods) to hide attributes that you don't want to allow public access to. Finally an instance of the class will...
11 Dec 2011 by Abhinav S
In a nutshell, Encapsulation is hiding certain parts of your program so that they are not accessible to everyone.Abstraction is hiding the complexity of the program.This[^] might help you out.
25 Feb 2012 by Abhinav S
Your question is actually too vast to answer easily.You need to look at all principles of OOPS and then start implementing them. Very often you will realise that you don't even need to use all of these principles in your class, only some will suffice.This comes with practice and there is...
2 Feb 2013 by Abhinav S
Just a naming thing.Instances of a class are created and these instances are the objects that will be worked with.
25 Jun 2014 by Abhinav S
Private constructor - a classic real world example is the Singleton pattern - Singleton pattern[^].There are tons of examples of this implementation available in different programming languages.Constructor overloading - if you create a shape class and then subclass circle and rectangle -...
24 Aug 2014 by Abhinav S
Generics and polymorphism can be made to work together - http://msdn.microsoft.com/en-us/library/vstudio/dd799517%28v=vs.100%29.aspx[^].
20 Apr 2015 by Abhinav S
Encapsulation is hiding of data for e.g. using private access modifiers to protect a variable from outside the method.Abstraction is different - it is hiding of complexity and showing only certain components. For e.g. a component say a class could only be accessible to the outside world...
10 Jan 2016 by Abhinav S
You could set values in the constructor to avoid using the SetNum() method.public class B { private A a = A.getInstance(); B(){ //some codes was executed and get the result a.setNum1(result); }
7 Aug 2014 by Abhishek Bose
Why do we need Interfaces?
20 Mar 2012 by Abhishek Nandgaonkar
Given two classes, creating an object of each class in one another results in StackOverflow Exception. It is a JAVA project btw.There are multiple classes in my projects and for using the other classes, I thought i would create objects of the other class and use it.Say i have class Main...
2 Feb 2013 by Abhishek Pant
Difference between object and instance[^]difference between instance & object[^]
27 Feb 2014 by abid zahid
can i override non-abstract method in c#?
25 Apr 2018 by achraf boumessouer
Inconsistent accessibility: base class 'ClassLibrary3.CDRFinal' is less accessible than class 'ClassLibrary3.CDRList' What I have tried: Nothing
16 Jun 2013 by Adam Tibi
We are used to repeat the SOLID principles, sometimes without giving them full thoughts. This is a call to drop an outdated principle that doesn't work in today's development, the "Open Close Principle", the result should be SLID.
21 Aug 2012 by Adam_adam
Can overriding and overloading both achieve polymorphism?
21 Aug 2012 by Adam_adam
When I use abstract classes? How do I make a concrete class abstract?
24 Feb 2012 by Addy Tas
Being fair i'd say it's not the nicest code i've seen an i but it seems to do as requested. Now the difficulty, when you are writing code for someone to evaluate what you're level might be, i'd draw up a rather extensive model with e.g. a data manager, calculation engine and more stuff you might...
20 Oct 2011 by AditSheth
public & private is not a type of variable..it keywords to specify access levels for member variables. See ThisAnd Your Answer is (access levels for member variables): Private Let test this example...class Test { String Test1; public string Test2; ...
3 Nov 2010 by Aescleal
Not sure exactly what you're asking here...If you want a documentation tool that converts your C++ to HTML then look no further than Doxygen.On the other hand if you're trying to write a tool to do something similar then it's probably a good idea to start with some simple requirements....
4 Sep 2015 by Afzaal Ahmad Zeeshan
This post attempts to describe the general difference between overloading and overriding in Object-oriented programming languages.
23 Jan 2016 by Afzaal Ahmad Zeeshan
Object-oriented is a paradigm, not even a programming language. You can surely create a diagram of the objects related in the cart or the database. But, you won't be able to publish it, because it won't work. To create such a thing, you need a framework: ASP.NET for instance.ASP.NET, PHP or...
16 Apr 2017 by Afzaal Ahmad Zeeshan
What you need to learn here are: 1. Inheritance 2. Polymorphism And then later on, in the advanced concepts, you also need to understand how an API is developed. Probably, in most cases, an interface is used where you need to define a structure of your contract — in APIs, especially where you...
24 Oct 2017 by Afzaal Ahmad Zeeshan
That is why they are typically called a tutorial, and not a demonstration or sample project. Tutorial is only intended to showcase the concept and to explain the concept, it is very less likely that someone would be interested in developing an entire project, with every OOP concept just to write...
9 Mar 2018 by Afzaal Ahmad Zeeshan
Apart from what John suggested in Solution 1, please also read about value-types and the reference-types in .NET framework context. In the context, if the developer leaves out the initialization step and only performs declaration, the default value is assigned — which is obvious. I am not an...
2 Sep 2019 by Afzaal Ahmad Zeeshan
Quote: as you guys can see class `Employee` extends `Person` thus it will have all it's fields and method right ? Only if you will do, Employee e = (Employee)p; Then, after a cast, you can see Java being printed. Currently, there is no connection between what p is having and what e contains....
11 Jul 2020 by Ahmad Qassym
## the first example class quadriLateral: def __init__(self, a, b, c, d): self.side1=a self.side2=b self.side3=c self.side4=d def perimeter(self): p=self.side1 + self.side2 + self.side3 +...
24 Jun 2016 by Ahmed Abd EL-Latif
SOLID Principles that enable software architect to build good designed class in object oriented programming
9 Dec 2016 by ahmed_sa
some one ask me in interview for c# developer for job question But i cannot answer him . This question is : IF you create class and do some changes in this class and you dont need this changes happen . what the ways that prevent this changes happen tell us two way to...
17 Dec 2018 by ahmed_sa
I work on c# on visual studio 2015 i read and using interface class more public interface dataInterface { //prototype function here } and it have big role in solving multi inheritance on csharp so that What is the problems or disadvantages of using interface ? What I have tried: what is...
10 May 2012 by ahp-1984
Hi, I am asp.net programmer.i have read the articles of abstract class and interface and i know how to implement it also.but can anybody explain me practically i.e. by referring project scenario where to use abstract class and where to use interface? I need a very practical or real...
10 May 2012 by ahp-1984
Hi Gurus, I want to develop asp.net application,so am looking for the sample web application or where almost covered the basic concepts which am going to listed out here1)Application should be 3 tiered.2)It contain rich use of abstract class and interface3)It should cover use of...
20 May 2012 by Ajay Matharu
Wherever object of parent class is expected, object of child class can go.
3 Jun 2012 by Akash Detroja
Hi anyone have answer,Using sealed Class Can We get performance Benefits?ThanksAkash
23 Feb 2017 by Akhil Jain
let's say that i have a Class BuildingBuilding house = new Building();now i was reading in a book that say that Quote:This declaration performs three functions. First, it declares a variable called house of theclass type Building. This variable is not, itself, an object. Instead, it is...
15 Jul 2015 by Akhil Mittal
This article will cover almost every OOP concept that a novice/beginner developer hunt for, and not only beginners, the article’s purpose is to be helpful to experience professionals also who need to sometimes brush-up their concepts or who prepare for interviews.
15 Jul 2015 by Akhil Mittal
Diving in OOP (Day 2):My article in the second part of the series will focus solely on inheritance concept in OOP
9 Apr 2016 by Akhil Mittal
This part of the article series will focus more on run time polymorphism also called late binding.
15 Jul 2015 by Akhil Mittal
Access modifiers (or access specifiers) are keywords in object-oriented languages that set the accessibility of classes, methods, and other members. Access modifiers are a specific part of programming language syntax used to facilitate the encapsulation of components.
21 Jul 2015 by Akhil Mittal
Day 6: Understanding Enums in C#.My article of the series “Diving in OOP” will explain enum datatype in C#.
21 Jul 2015 by Akhil Mittal
OOP: Properties in C# (A Practical Approach).
21 Jul 2015 by Akhil Mittal
OOP: Indexers in C# (A Practical Approach)
21 Jul 2015 by Akhil Mittal, Vikas Sharma
Understanding Events in C# (An Insight)
4 Dec 2012 by Alan N
The error messages from the compiler tells you that you are using the drawpoly function incorrectly. The second argument should a reference to a one dimensional array of points.http://www.programmingsimplified.com/c/graphics.h[^]Alan/
1 Apr 2011 by Albin Abel
I hope the links given by SAKryukov and Original Griff give you a clear picture. I am agree with the comment of Amit Kumar Tiwari. But the point I am stress here is there is no hard rule which one to use. It depends on your necessity. Let me give you a situation which favors Interface over...
8 Sep 2016 by Alex Banu
try rewrite this:$SelectQuery->db_select($query_table, $query_extra);$date = $db_select->$result;$date = mysqli_fetch_assoc($result); like $date= mysqli_fetch_assoc($SelectQuery->db_select($query_table, $query_extra));
20 Feb 2024 by Alex Rakov, Alexandre Bencz
ELENA is a general-purpose, object-oriented, polymorphic language with late binding
19 Jan 2018 by Alex Schunk
GitHub - Fody/Costura: Embed references as resources[^] NuGet Gallery | Costura.Fody 1.6.2[^]
9 Jan 2017 by Alief Kurniawan
if you're in a programmers from one programming language based on objects as well as Java, C ++ or another, if given the choice to make the program and type of Oop, such as Enkapsulasi, Inheritance and Polimorfism, methods which would you choose?Give me the reason and the difference between...
11 Jun 2021 by Alvin Smith
Hello! I'm new to Java programming and Object-oriented programming. Please help me. I have 6 classes here: Bank, Customer, Account, CheckingAccount, SavingsAccount, and TestBanking. A Bank can have multiple customers(but i initialize the num of...
22 Nov 2014 by AminMhmdi
i have CURD class for do basic Operation public class CURD { public void DoCreate() { // Create User } public void DoUpdate() { // Update User Info } public void DoRead() { ...
4 Dec 2014 by AminMhmdi
tnx for response as Sergey say i must "improve my code design" i think best solution is create Some Boolean Field for each of User such as:Bool canCreateBool canReadBool canUpdateBool canDeleteand set this value from database to each
27 Feb 2018 by Amir Jalilifard
Lets take an exciting travel to the land of MVC, MVP and MVVM patterns with our sexy friend : JavaScript
13 Feb 2011 by Amit Kumar Tiwari
Looks like I have lost my basics but really confused between the two. What is the core of the matter that differentiates the Encapsulation from Abstraction?As far as I get it:Encapsulation is binding of function, method, properties, events etc. in one capsule or Class with appropriate...
3 Jun 2012 by AmitGajjar
Hi,Sealed, internal, private all this are just restrict class for visibility. this will not impact on your code performance.Thanks-Amit
7 Oct 2012 by AmitGajjar
Hi,There are so many examples available on internet, All you need to relate with the real life scenario. But here are some of the example you can refer.Interface example[^]All about abstract classes.[^]Hope it works for you,Thanks.
17 Dec 2013 by An@nd Rajan10
The choice of whether to design your functionality as an interface or an abstract class (a MustInherit class in Visual Basic) can sometimes be a difficult one. An abstract class is a class that cannot be instantiated, but must be inherited from. An abstract class may be fully implemented, but is...
4 Nov 2012 by Andrew_Borg
HiI would like to Ask a Question about compiling an OOP Java application.Below is a Class Called ComputerGame.java which holds Game Details.package OOP;public class ComputerGame{ private String Name; private String Description; private float Cost; private boolean...
15 Aug 2011 by AndreyPereira
Try enabling SSL and use port 587Also, always check for your anti virus
21 Jul 2015 by Andy Lanng
Google is great:1: Function Overloading[^]2: All about abstract classes.[^] / Interfaces in C# (For Beginners)[^]3: [Question malformed] B inherits A but must invoke abstract method getdetails(). This is not implemented correctly in your class as I would expect to see some {}...
28 Oct 2017 by anil_bang0011
Hi Dear friend , I have one question i have study both class static or sealed class1)Both class can't be inheritance 2)we can not create object 3) we directly use by name but what is the differences in these two class i think all this answer as fresher level . but i...
2 Sep 2013 by anjankant
Hi Everybody,Can you help me explain in detail difference between interface and abstract class.Thanks ;)
3 Sep 2013 by anjankant
Hi Everybody, Can you have good idea about how can we export database to PDF using with itextsharp component. I need to add logo in header also in specified location also. PDF file should be same as data in datatable/gridview.Thanks!
8 Mar 2011 by ankush7697
Q9:Difference between (in a tabular form)…FUNCTION & MEMBER FUNCTION?Q10:NAME THE FUNCTION THAT ENABLES A FILE POINTER TO SET IT FOR WRITE OPERATIONS?
29 Jun 2017 by AnotherKen
Person p = new Student(); Should be Student p = new Student(); This would instantiate an object of type Student which inherits the Person properties and implements the ID property. p = p as Student; this typecast is not necessary. now you can access the ID with p.ID
29 Jun 2017 by AnotherKen
How do you want to use Polymorphism? For instance, you are already overloading the assignment operator to be able to set and get property values for the Person and Student objects with "=". If you also want to overload the assignment operator to allow you to do something like Person a =...
2 Jan 2012 by ANOUAR JLIDI
plz explain by example a marker interface in JAVA and C# examples:copy-paste do not that,, thanks for advance!!!!!
24 Mar 2014 by Anubhav689
Hey,One of my friend had created an Article on the same, hope this will help you:http://www.c-sharpcorner.com/UploadFile/2b481f/how-to-pass-data-from-one-form-to-another-form-using-class/[^]\Accept the answer if it helps you